[CLUE-Tech] pipe list of file names to vim

Jeff Cann j.cann at isuma.org
Fri Dec 26 02:26:40 MST 2003


On Wednesday 24 December 2003 8:34 am, David Anselmi wrote:
<snip>
> And of course there's always:
>
> grep -l 'bob' * | xargs vim
>
> if you have a lot of files (in which case maybe vim can't open them all,
> or you want sed instead of vim, or ...)

Dave,

Thanks for the xargs suggestion.  I haven't used this util before, but I 
obviously have been missing out.  Here's a command that I used to find all 
*.jsp files and then execute a perl in-file search and replace for the string 
src="img to src="/img:

$ find . -name "*.jsp" | xargs perl -pi -e 's/src=\"img/src=\"\/img/gi;' *.jsp

Once again, the command line rocks!

-- 
http://isuma.org/



More information about the clue-tech mailing list