August 19th, 2003, 11:55 PM
i had a question regarding the "diff" command. if i do
"diff filea fileb > filec"
is there a way to keep only the data differences ignoring the ">", "----", line numbers, etc that diff prints along with the differences ??
any help would be greatly appreciated
August 22nd, 2003, 03:13 PM
Well, looking at the man pages for diff doesn't seem too encouraging for having diff itself do it, or any of its variants for that matter either (taken from man pages on a Solaris 8 Sparc system)
You could get the results you want from other programs however:
First, diff the files to a third file, I'll call it newfile, and then run something like the following:
cat newfile | sed s/\<\ //g | sed s/\>\ //g > cleanfile
Basically, that will remove all the '<' and '>' and the following spaces (so as to align the output properly to the left margin).
Run another sed command and you could get rid of the '---' and number lines as well. Or, awk might work as well.
Hope this helps.