tags:

views:

135

answers:

1

Hey guys,

I got some files, after an egrep command, like

egrep -l -r '(this|that|those)' *

this will list like, 20 files. I don't want to open each one manually, theres any way that I can redirect the result from grep, directly to an editor? So the editor will open those files to me

Thanks

+1  A: 
egrep -l 'pattern' * | xargs $EDITOR

$EDITOR should be set to your editor of choice, obviously.

OTOH said editor probably has a shorter, non-caps name, so you'd just type it directly.

Me, I'm all day doing this:

ack --ruby -l 'pattern' | xargs mate

(Also take the tip that ack is way cooler1 than egrep and does recursive file matching by default, with filters per file type)


1 Where by cooler I mean real perl regular expressions.

kch