I am trying to figure out which files I need to modify; so by that, I use sequences of grep commands. I want to find out which files contain both foo and bar. Therefore, my command is:
grep foo `grep bar * -l` | awk -F':' '{print $1}' | sort | uniq
This command gets me a big list that looks like this:
pageABC.txt
pageBCD.txt
pageDEF.txt
I want this output to be opened in emacs. So what I'd normally do is:
emacs ` whatever_was_in_my_output `
This command normally opens all the files.
If I try
emacs `grep foo `grep bar * -l` | awk -F':' '{print $1}' | sort | uniq `
Emacs won't even start. Maybe it's because of the double grave accents used.
Any ideas how to solve this?
Many Thanks,
D
awk, you could also pass-lto the outergrep.