How do I make better the following method of comparing certain lines (lines that start with "@") of two files? I feel certain this could be done on one line and without embarrassing temporary files. I am pretty new to Linux so go easy on me! Thanks in advance.
grep "^@" myfile1 > temp1
grep "^@" myfile2 > temp2
diff temp1 temp2
In Bash, you can use <(...)
, which will handle temporaries (usually implemented as named pipes under the hood) for you:
diff <(grep "^@" myfile1) <(grep "^@" myfile2)
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