I have 2 big files and I want to make a diff between the top lines of each files, but i don't want to use intermediate files. I would like to do something like that :
diff `head -n 2000 file1.log` `head -n 2000 file2.log`
I remember I've done something like that a long time ago, ie. make a command like head -n 2000 file1.log
interpreted as a file. But I don't remember how. Maybe it was another shell...
Thank you.
diff stands for difference. This command is used to display the differences in the files by comparing the files line by line.
A. Use comm command; it compare two sorted files line by line.
You're probably thinking of process substitution in bash. For example, try:
diff <(head -n 2000 file1.log) <(head -n 2000 file2.log)
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