I type
grep -r 'something' .
and grep finds a lot of hits.
Now I want to open all files that were found.
I try
grep -r 'something' . | xargs vim
nothing happens.
Maybe this ?! :)
grep -rl 'something' . | xargs vim
or
vim "$(grep -rl 'something' .)"
-l, --files-with-matches
Suppress normal output; instead print the name of each input file from which output would normally have been printed. Scanning each input file stops upon first match.
Assuming there are no special characters in your files (like newlines), try this:
grep -lr 'something' . | xargs bash -c 'vim "$@" < /dev/tty' _