Wednesday, July 20, 2011

Find and replace text/characters in solaris/linux

Following command will search for files having name containing "hell" containing word  Hello and replace it with Hi.

# find and replace solaris
find ./* -name "hell*" -exec perl -pi -e 's/Hello/Hi/' {} \;

# find and replace in linux
 find ./* -name "hell*" -exec sed -i 's/Hello/Hi/' {} \;

No comments:

Post a Comment