[Gllug] Batch Text Replacement

Dan Kolb gllug at eco.li
Mon Oct 29 11:41:50 UTC 2007


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.

Dan
-- 
			Chapter 1

The story so far:

	In the beginning the Universe was created.  This has made a lot
of people very angry and been widely regarded as a bad move.
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list