Lets say i have two files like below:
file1
a 23
b 34
c 47
file2
a justin_beiber_sucks
b segmentation fault
c jackson
d nop
Now what i want is to get a diff of the first column of two file. I'm doing it now like
$cat file1 awk '{print $1}'> f1
$cat file2 awk '{print $1}'> f2
$diff -u f1 f2
But this approach feels retarded. Any tricky approach there?
Problem is i always view pipe
s as one dimensional thing, but here its two dimensional. I mean the input to diff has to come from two different sources simultaneously.
starting point may be the awk script will read both files, do filtering and save the result in a temporary associative array, next it will invoke diff and will supply its inputs.