Use output of two greps with diff

diff, grep

Solution

In Bash, you can use `<(...)`, which will handle temporaries (usually implemented as named pipes under the hood) for you:

diff <(grep "^@" myfile1) <(grep "^@" myfile2)

Problem

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 ```

Original source