2010/09/10

Automated text editing


Well, sort of automated; there's no decision-making being made for the human.

Batch Replace, Text Replace in each file from forums.devshed.com
For every file of type f in certain directory [what's type f?]:
find /path/to/start/from/ -type f | xargs perl -pi -e 's/applicationX/applicationY/g'
For every file in current working directory:
ls -1|xargs perl -pi -e 's/10.200.8.6/10.200.8.21/'

Batch Add to end of line from unix.derkeiler.com
I needed to add (the "-a" string") to a specific line in each file, this did the trick! The $ indicates the end of line, but I don't know how it works beyond that... Obviously, I need to spend more time learning sed!
cat branchoperations.selectstaffing.com.cfg|sed '/service_description/s/$/-a/'
Adapted to:
ls -1|xargs sed -i '/service_description/s/$/ SelectIIS6-A/'

No comments:

Post a Comment