Lets assume that I am in a directory with a lot of files. How would you search the contents of all the files in a directory and display the longest line that contains the string “ER” but not “Cheese”?
So far, to my best knowledge, I'm trying to do this in one line command.
I am thinking I need to use grep -r for recursive, in order to search through all the files in the directory but my end goal is to just display the longest line, so I assume so far it should be like:
grep -r -e "ER"
and when I do -v "Cheese" attached to it out of small hope, it doesn't work of course.
Is this not possible with one line of command? If so, what would I need to do in multiple lines?