Bruce Munro wrote:

Roel Schroeven wrote:

Kurt V. Hindenburg wrote:

Anyone know a diff program that you can skip # lines at the beginning of each files? Googling for diff is about worthless...



Pipe trough tail. 'tail -n +#' outputs everything from the #th line to the last, so 'tail -n ## | diff' (where ## = # + 1) does what you want).


Slight problem with this, it won't work. Diff(1) takes two arguments, which are filenames(or directories) and compares the two, the special filename '-' tells diff to read from stdin, but even then you would only get one of the files with the unwanted lines removed.

You're right of course, I was too fast.


A small shell script like this would do the job(where $numlines is number of lines to be ignored):

tail -n +$numlines file1 > file1.tmp
tail -n +$numlines file2 > file2.tmp
diff file1.tmp file2.tmp

Obviously this would need beefing up to make it a proper script with arg handling and so on, and also the line numbers output would be off by the amount stripped from the beginning of the file. You could post-process the diff output, to make the line numbers correct in relation to the original files.

Indeed. I don't know a better solution, unfortunately.


--
"Codito ergo sum"
Roel Schroeven


-- [EMAIL PROTECTED] mailing list



Reply via email to