Showing posts with label sed. Show all posts
Showing posts with label sed. Show all posts

Wednesday, August 17, 2005

Once I wrote a global search and replace ...

... and now I find that a simple bit of unix command line replaces hundreds of lines of MoonRock BASIC.

$ for x in *.chk; do cat $x | sed -e s/Database=/Filename=/ > tmp; mv tmp $x; done

Get every file ending in .chk, pipe it through sed to change the relevant string, capture the result into a temporary file and then copy it over the original.