Over a million developers have joined DZone.

One-line Shell Script For Find And Replace

·
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:

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

{{ parent.tldr }}

{{ parent.urlSource.name }}