We Recommend

bash Cookbook: Solutions and Examples for bash Users bash Cookbook: Solutions and Examples for bash Users
bash Cookbook teaches shell scripting the way Unix masters practice the craft. It presents a variety of recipes and tricks for all levels of shell programmers so that anyone can become a proficient user of the most common Unix shell -- the bash shell -- and cygwin or other popular Unix emulation packages.


Posted By

ches on 02/15/08


Tagged

regex Bash replace perl


Versions (?)


Perl Search and Replace One-liner with xargs -0


Published in: Bash 


\Q...\E perl quoting means no ugly escaping in the regex. find's -print0 with xargs -0 is the secret to handling files with spaces in their names.

  1. find . -name "*.html" -print0 | xargs -0 perl -p -i -e 's|\Qhttp://66.36.242.244/~olxhxlwq/\E|http://www.johnclarkprose.com/|g'

Report this snippet 

You need to login to post a comment.