Friday, July 10, 2009

using sed

The Cygwin install on the server running colinux doesn't have vi, so sed is useful on occasion. This useful page has the basics. String replace has the syntax
's/{old value}/{new value}/'
like
$ echo The tiger cubs will meet | sed 's/tiger/wolf/'
The wolf cubs will meet
which of course you can pipe to a new file.

The article mentions that sed can change any printable character with another printable character, but use tr instead for unprintable characters. It also discusses append and insert.

No comments:

Post a Comment