[plug] grep task?

James Devenish devenish at guild.uwa.edu.au
Sat Nov 22 16:16:10 WST 2003


In message <20031122070847.GR16698 at amidala>
on Sat, Nov 22, 2003 at 03:08:47PM +0800, Bernard Blackham wrote:
> You can replace this line with:
> 
>   sed -i.bak -e 's/anarchist at blah/entombednerds at blah/g'

I think the traditional solution (if you have one of the many versions
of sed that hasn't changed in a decade) is to use the faithful ed/ex/etc
editors. E.g.:

TMP==( echo '%g/anarchist at blah/s//entombednerds at blah/g'; echo f; echo w; echo q )
find . -name '*.html' -print0 | xargs -0 -n1 ex -c "source $TMP"
rm -f $TMP

The above will inform which files were modified, *but* I presume the sed
solution will be significantly faster for large numbers of files.

PS. `etc` is *not* an editor that I know of -- I was just being
facetious.


_______________________________________________
plug mailing list
plug at plug.linux.org.au
http://mail.plug.linux.org.au/cgi-bin/mailman/listinfo/plug


More information about the plug mailing list