sed - the stream editor



sed 's/old/new/' < ORIGINAL_FILE > NEW_FILE
sed 's/old/new/' ORIGINAL_FILE > NEW_FILE
cat ORIGINAL_FILE | sed 's/old/new/' > NEW_FILE

s/REGEX/STRING/
s:REGEX:STRING:

s/c./(&)/     & represent the whole match

echo fool | sed -r 's/(.)/(&)/'           (f)ool
echo fool | sed -r 's/(.)\1/(&)/'         f(oo)l
echo fool | sed -r 's/(.)\1/(double \1)/'     f(double o)l

Sed tutorial