Quickly Replace Text in Multiple Files with just One Command

Quickly Replace Text in Multiple Files with just One Command

Table of contents

No heading

No headings in the article.

Few of the time, we need to alter some particular text in multiple files, and opening and editing each file at a time is a killer. Here is a sweet simple command that uses the "Power of PERL" to make our life easier.

Command:-

perl -pi -w -e 's/facebook/worldofhacker/g;' /home/krokite/*.txt

What basically above command does is, It will find the word facebook in each "text/notepad" file under the directory "/home/krokite" and will replace that with worldofhacker.

Subscribe to my blog, for more awesome tricks and hacks :)