Voder-Vocoder

The Log of Hal Canary

Navigation: Home | THE LOG | Log Archives | Resume | Contact Info | Public Key | SSL | Math Applets | Site Map | WP Backend | RSS2 | Atom

« | »

sed in place

#!/bin/sh
SEDCMD="$1"
shift
for x in "$@" ; do
  dirt=`dirname "${x}"`
  tmp=`mktemp "${dirt}/tmp.XXXXXXXXXX"`
  sed "${SEDCMD}" < "${x}" > "${tmp}"
  mv "${tmp}" "${x}"
  echo "$x fixed."
done

UPDATE: The next day I realized that

sed -i

does exactly the same thing.

Hal Canary | Uncategorized | 2009-11-29 00:45:32 UTC
Permanent Link Comments Off | No Comments

Comments are closed.

Copyright 1997-2007 by Hal Canary.
mailto: h3 at halcanary dot org
xmpp:halcanary@jabber.org
aim:halwcanary
http://halcanary.org