Skip to main content

Quickly Replace Text in Multiple Files with just One Command

Updated 1 min readMarkdown
Quickly Replace Text in Multiple Files with just One Command

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

About the author

  • Engineer, Developer, Information Security Researcher, Code Digging, Software Exploitation, Web App Penetration testing, and Reverse Engineering, Browser Tech, Scraping, Automation, Hacking

No comments yet. Be the first to comment.