Advertise

Sunday, 6 October 2013

How to 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 editing each file at a time is killer. Here is sweet simple command that uses "Power of `PERL`" to make our life easier.


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


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


Subscribe us, for more awesome tricks and hacks :)
 
World of Hacker © 2011 Creative Commons License
World of Hacker by KroKite is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Based on a work at http://www.worldofhacker.com.
Permissions beyond the scope of this license may be available at https://groups.google.com/forum/#!newtopic/hackerforum.