perl command line usage examples aka one liners
Search and replace..
You have a directory with many html files. In them- you have ocurrences of the email address jim@hardwire.com, you need to change it to james@gmail.com..
First, for curiosity’s sake.. What files have this text ‘jim@hardwire.com’ ?
find /home/myself/www/public_html -type f | xargs grep 'jim@hardwire.com'
This will output what files have that text, and where.1
I wanted to replace usage of one module in a test script with another.
The old module is DMS::AP::Base, I want to change the text in the tests to DMS::Base::AP
perl -p -i -e 's/DMS::AP::Base/DMS::Base::AP/g' ./t/*.t
There are many more detailed sources of information on perl one liners.2
1 This is text that explans etc etc. Furthermore etc etc. Furthermore etc etc. Furthermore etc etc. Furthermore etc etc.
