Thursday, June 19, 2008

SED & TR uses

Here are the quickies for my very own sed and tr:

To replace "NEWLINE" (\n) with "comma" (,)
cat filename | tr '\n' ','


To find "tree" and replace with "plant" in a file (using sed):
sed -i 's/tree/plant/g' filename

No comments: