I´d like to compare two files, but I don´t want to take into account the first 10 lines, and the last 3 lines of both files. I tried to do it with diff and tail commands, like in here, but without success. how can I do it?
Use GNU tail
and head
:
To ignore the first 10 lines of a file, use tail
like this:
tail -n +11 file
To ignore the last 3 lines of a file, use head
like this:
head -n -4 file
You can then construct your diff
command using process substitution as follows:
diff <(tail -n +11 file | head -n -4) <(tail -n +11 file2 | head -n -4)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With