I have an external command, say
check_this, which would spit out YES or NO for a file piped to it
cat myfile | check_this YES NO YES YES ...
Now I want to get all the lines in myfile with YES results. Is there a way to do this? Currently I use a tempfile, save it to another file, then use paste + grep, which is cumbersome and not robust.