Thank you @Yoda....
But I used the segment with awk in your other post in my code as below ... That worked fine too.. Thanks a lot
join -t"," -1 1 -2 1 -a1 file1.csv file2.csv | awk -F, ' BEGIN {
print "ID,field,old,new"
} NF > 3 {
if ( $3 != $5 )
print $1, "cost", $3, $5
if ( $2 != $4 )
print $1, "version", $2, $4 } ' OFS=,
echo "the IDs which are not present in first file are ">>file3000.csv
awk -F, 'NR==FNR{_1[$1]++;next}!_1[$1]' file81.csv file82.csv >> file3000.csv
cut -d',' -f1 file3000.csv>>file3001.csv
cat file3001.csv
echo "the IDs which are not present in second file are ">>file4000.csv
awk -F, 'NR==FNR{_1[$1]++;next}!_1[$1]' file82.csv
file81.csv >> file4000.csv cut -d',' -f1 file4000.csv>>file4001.csv
cat file4001.csv
In addition to list down the differences in fields(cost / version) between 2 files I also needed to create a new file
which contains the missing IDs in a file compared to the other... The o/p which I got is as below...
ID,field,old,new
2000,cost,40,45
3000,version,3,4
3000,cost,50,55
the IDs which are not present in first file are
6000
7000
the IDs which are not present in second file are
4000
8000
---------- Post updated at 04:39 PM ---------- Previous update was at 04:24 PM ----------
And can I attain the same result as mentioned above using perl scripting?..
In that case what changes should I make?... I went through Perl script basics but it seemed to be different altogether from bash/ksh...