[NBLUG/talk] command line search/replace
Ross Thomas
boscorama at fastmail.us
Thu Nov 2 16:50:13 PST 2006
On Thu, 2 Nov 2006 16:26:41 -0800, "Barry Stump" <barry.stump at gmail.com>
said:
>
> .... or shall I open all matching files in vim and use :%s/this/that/gc
> on every buffer? Any other ideas?
I think your about as close to the optimal solution as you can get.
However, if you can supply a list of files, you can mitigate a lot of
the typing this way:
cat file_list | xargs -l1 vim -c '%s/thiis/that/gc'
(that's dash-el-one after the xargs).
or even:
cat file_list |
while [read line] ; do
vim -c '%s/this/that/gc' "$line"
done
This will invoke vim on each file and start the search & replace
immediately. Obviously, 'cat file_list' can be anything that gives
one pathname per line, e.g. find, etc.
HTH.
Ross.
--
http://www.fastmail.fm - The professional email service
More information about the talk
mailing list