5

How to get different record in two files?

view full story
linux-howto

http://www.unix.com – Hello, guys! I want to find difference between two file according $1. I using the following code, but get wrong results. Code: awk -F, 'NR==FNR{A[$1]=$0; next} $1!=A[$1]' file1 file2 I can using the following code get same record between files. when I used the code above, the output just same as file2. Code: awk -F, 'NR==FNR{A[$1]=$0; next} $1=A[$1]' file1 file2 ---------- Post updated at 09:21 PM ---------- Previous update was at 09:05 PM ---------- Code: awk -F, 'NR==FNR{A[$1]=$0; next} !A[$1]' file1 file2 I found this might be ok. (HowTos)