bash: diff ignoring certain columns
by schneidz from LinuxQuestions.org on (#4TQBP)
[a.i.x.]:
Code:cat s1.lst
chun-li,hello,0451,world
cat s2.lst
ryu-ken,hello,0000,worldi would want to ignore the 1st and 3rd columns (the byte-offsets are alwaze the same).
i have two files with about 30 columns (one has 39,952 rows; the other has 40,215) and i wanna' compare which serial-numbers (last column) have different data (date, time, processor, ... fields will always be different).
i dont have gnu extentions but i do have access to a c compiler.
maybeCode:cat serial.number | while read serial
do
grep $serial s1.lst | cut -b 100-125,134- > s1.buff
grep $serial s2.lst | cut -b 100-125,134- > s2.buff
diff s1.buff s2.buff
done > report.lstwill work ?


Code:cat s1.lst
chun-li,hello,0451,world
cat s2.lst
ryu-ken,hello,0000,worldi would want to ignore the 1st and 3rd columns (the byte-offsets are alwaze the same).
i have two files with about 30 columns (one has 39,952 rows; the other has 40,215) and i wanna' compare which serial-numbers (last column) have different data (date, time, processor, ... fields will always be different).
i dont have gnu extentions but i do have access to a c compiler.
maybeCode:cat serial.number | while read serial
do
grep $serial s1.lst | cut -b 100-125,134- > s1.buff
grep $serial s2.lst | cut -b 100-125,134- > s2.buff
diff s1.buff s2.buff
done > report.lstwill work ?