The handy one liner command line Perl hack…..

I was first shown this in 1997 when I was a “html author” at the Press Association.  As most text editors are pretty naff and can’t open large files what do you do when you’ve got a 50Mb MySQL dump and every domain needs changing from test.domain.com to www.domain.com?You use Perl…. (perhaps I’m too old school or something but not many people seem to know about this nugget anymore)

perl -i -p -e "s/test.domain.com/www.domain.com/g;" mybigmysqldump.sql

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: