[Gllug] Batch Text Replacement

John Hearns john.hearns at streamline-computing.com
Mon Oct 29 12:34:19 UTC 2007


On Mon, 2007-10-29 at 11:41 +0000, Dan Kolb wrote:
> On Mon, Oct 29, 2007 at 08:50:33AM +0000, Tethys wrote:
> > 
> > 	for file in *.html
> > 	do
> > 		tmp=$(mktemp "$file.XXXXXXX")
> > 		sed 's/ *style="[^"]*"//' "$file" > "tmp" && mv "$tmp" "$file"
> > 	done
> 
> GNU sed allows for in-place editing, so you don't need the redirects and 'mv'.
> Check up on the '-i' option.

Depends on how dangerously you want to live.

I use sed -i myself, when I have call to get sed out of the armoury.

But ALWAYS ALWAYS back up files before developing/testing sed scripts.


-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list