find and perl as alternative for sed

In continuation of my migration, some directories with HTML contents their are manually inputted by strings that would let a typical user to edit manually all the HTML files for just a sake of changing a text. However, Perl as an alternative for sed is quite helpful.

The command goes like this:

perl -e "s/www\.hawaiifsbos\.com/test\.hawaiifsbos\.com/g;" -pi $(find . -type f)

-p = will do a loop sequence. For more info, read the page in "Using the -n and -p option"
-i = will modify file in-place. providing after the "i" letter with a word, will be used as a back-up suffix of a file. (Ex. -pi.bak)
-e = means execute

This is the same thing as

find . -name "*.*" -type f -exec sed -i 's/www.mysite.com/test.mysite.com/g' {} \;

The above works in my Slack, but it seems weird it doesn't do in FreeBSD, but the perl is there as my alternative.

Comments

Popular posts from this blog

LVM: How to remove a volume using pvremove

Using Oracle 11g thru VirtualBox appliance in Mac OS X Lion

Use Shell Editor for Eclipse for editing bash, ksh, csh in Unix/Linux system