Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jan 2005 06:56:16 +0100
From:      Anthony Atkielski <atkielski.anthony@wanadoo.fr>
To:        freebsd-questions@freebsd.org
Subject:   Re: One-line global string replace in all files with sed (or awk?)
Message-ID:  <1098984237.20050128065616@wanadoo.fr>

next in thread | raw e-mail | index | archive | help
My thanks to all who replied.  I ended up using this form (I don't
recall who suggested it):

find . -type f | xargs sed -i '' -e 's/foo/bar/g'

One problem, though:  It appears that sed touches every file, resetting
the last modification time, even if it didn't actually change anything.
This reset the last modification dates for every file on my site, which
wasn't much fun.  Is there another command I could put between find and
xargs that would filter only the names of files containing the string?
(grep would do it, but grep outputs the lines found to stdout, so that
won't do.)

-- 
Anthony




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1098984237.20050128065616>