Did you ever tried something like :
$ find -name '*.c' | xargs emacs or $ grep -rl snmp . | xargs emacs
and got the error “emacs: standard input is not a tty” ?
That’s normal, as the stdin for emacs is here the pipe, not your tty, you need a workaround to leave the normal stdin to your emacs.
There are different approches, the one I used for a long time was a command substitution :
$ emacs $(find -name '*.c')
But other approches exists, redirecting /dev/tty to emacs’ stdin :
$ find -name '*.c' | xargs sh -c 'emacs "[email protected]" < /dev/tty' emacs
And if you are searching for a specific pattern with grep, you should want to jump directly to the right line using the ‘+line file’ syntax of emacs, and the shell substitution :
$ emacs $(grep -rn snmp services/ | sed -r 's/([^:]*):([0-9]*):.*/+\2 \1/g')
It’s good while having only one occurence of the pattern in each file, but if many occurences exists, the file is oppened only once, with a while you can open one emacs for each occurence of the searched pattern and the /dev/tty redirection :
$ grep -rn snmp services/ | sed -r 's/([^:]*):([0-9]*):.*/+\2 \1/g' | while read line file; do emacs $line $file < /dev/tty; done