Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

One-line Shell Script For Find And Replace

DZone's Guide to

One-line Shell Script For Find And Replace

·
Free Resource
An equivalent of the other find-replace, except it's a one-liner that generates no temp files, and is more flexible:


perl -pi -e 's/find/replace/g' *.txt


Or, to change matching files in a hierarchy:


find . -name '*.txt' |xargs perl -pi -e 's/find/replace/g'
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}