Hack, Build & Scale - Web & Server apps

Follow

Hack, Build & Scale - Web & Server apps

Follow
Quickly Replace Text in Multiple Files with just One Command

Quickly Replace Text in Multiple Files with just One Command

R Sharma (WorldOfHacker)'s photo
R Sharma (WorldOfHacker)
·Nov 1, 2022·

1 min read

Play this 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 :)

 
Share this