--ScUgq5oMe+fJq4F1
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Thu, Feb 13, 2003 at 01:03:22PM -0500, Mike Starke wrote:
> How would I take the results of a grep command
> and apply a change to it? For instance, if I
> issue the command:
>=20
> 'grep -r smtp_addr *'
Well, from the shell, I'd probably do something like this:
$ grep -rl smtp_addr * |while read filename; do mv $filename \
${filename}.old; sed -e 's/old_value/new_value/' ${filename}.old > \
$filename; rm ${filename}.old; done
This assumes that you want to change what the files themselves contain,
which is what I got the impression that you wanted to do. Also, you may
want to omit the "rm ${filename}.old;", so that you have backups just in
case something went wrong.
On the other hand, you'd mentioned something about doing this from Perl,
so why not stick with Perl?
--=20
Bill Jonas * bill@billjonas.com * http://www.billjonas.com/
"It's a dangerous business, Frodo, going out your front door. You step
into the Road, and if you don't keep your feet, there is no knowing
where you might be swept off to." -- Bilbo Baggins
--ScUgq5oMe+fJq4F1
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE+S+esdmHcUxFvDL0RAmzZAJ9w6Q9T6hjW9j5x0FIsmkGBrf5VswCghyo2
yjgDas+vsIbvmvv/2Uh03m4=
=QRov
-----END PGP SIGNATURE-----
--ScUgq5oMe+fJq4F1--