Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jan 2005 06:50:34 +0000
From:      markzero <mark@darklogik.org>
To:        Giorgos Keramidas <keramida@ceid.upatras.gr>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: One-line global string replace in all files with sed (or awk?)
Message-ID:  <20050128065034.GC9405@logik.ath.cx>
In-Reply-To: <20050128064057.GB1559@gothmog.gr>
References:  <1098984237.20050128065616@wanadoo.fr> <20050128064057.GB1559@gothmog.gr>

next in thread | previous in thread | raw e-mail | index | archive | help

--6zdv2QT/q3FMhpsV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

> 	find . -type f | xargs grep -l 'foo' | \
> 	    xargs sed -i '' -e 's/foo/bar/g'
>=20
> When passed the -l option (this is a lowercase 'EL'), it will not print
> the matched lines.  Only the name of the files that *do* match.  Then,
> once you have a list of files that really do match with 'foo' as a
> pattern, you can xargs sed on the list to substitute whatever you want :-)
>=20

Egh, I forgot about -l. There's me piping things into the bit bucket.

*shuffles off into the shadows*

--=20
PGP: http://www.darklogik.org/pub/pgp/pgp.txt
B776 43DC 8A5D EAF9 2126 9A67 A7DA 390F DEFF 9DD1

--6zdv2QT/q3FMhpsV
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (FreeBSD)

iQIVAwUBQfnguafaOQ/e/53RAQLuZA//c2qNmwFTDscioSvu6Mb+UDqms/aw1JVr
QGwFkV76pbENmf5BVfhHzoYtsofxc7abXXVoocDNYHG41JiDjkAmk+lHMxyM+Ipx
EIOQel9q2lUzR46eOJNXFCuJf2silYl1Hzt1k+S8KQM0vKEjCZOFUkSH/L+ml4GY
E1IYMpK2O4gRJ86r6UtMhRc4Ss8BnQX8zN2cc4xYpP/Tct/f+YV7C7Hl1IIeHRo0
ca+Rg8fvNMgpn+Icud7vTmtODKiyICBzmsIuRDUVWgh8tfZuyy3LjzEpTFGAoVYj
gI88xDJgqYrmyxiq72+GZjJMSjGaJWZiYG03HaT2nZ+I9JqO4oU3j1nXy47Jgas6
T7IP1RZDdSiEQqwksvMiIauEJxYxh9SPKSempDGeUN2gStry9TCuAtyw0IG7FsXc
Wwr3nzPjGqr1eTrZB1Ffq+MDkdCipGp+XyEAwUoktQzmiZs27pF+kcINl43pxIOg
kgGo5+mVvzJPrGOerQFaSOMK+ZlfMSsxTWDJ8uPl3WvRTyZ7IfmJ5V2M2Uy3MiTS
IDXl/jn7xLjmNwf2oXZ93NP/95GWMlajq9gk5sa2Iqw0TkcPU4AOZBPVxUGojTfk
+tPD+V+r6lVSWIZjpBSMoCaHb+tfpYdhqLHoMMwlMVNpBKIowchXxCKrddlATBEY
SoPXKmW8p4s=
=h5Vn
-----END PGP SIGNATURE-----

--6zdv2QT/q3FMhpsV--



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