Hi, i've two files (file1, file2) i want to take value (in column1) and search in file2 if the they match print the value from file2.
this is what i have so far.
awk 'FILENAME=="file1"{ arr[$1]=$1 }
FILENAME=="file2"
{print $0}
' file1 file2
Hi, i've two files (file1, file2) i want to take value (in column1) and search in file2 if the they match print the value from file2.
this is what i have so far.
awk 'FILENAME=="file1"{ arr[$1]=$1 }
FILENAME=="file2"
{print $0}
' file1 file2
try:
awk 'FILENAME=="file1"{ arr[$1]=$1 }
FILENAME=="file2" {if(arr($1] ) {print $0} }
' file1 file2
Hi Jim, thanks this is working.
what should i do if i want to compare file2 (col1) not in file1 (Anywhere in file). then print the line from FILE2.