sed examples
Last revision August 6, 2004
Table of Contents: |
Remove trailing blanks or tabs at the end of any line:
sed -e 's/[ ^I]*$//' input > output
(here, the ^I means the TAB character, normally obtained by pressing the TAB key, although you can also press CTRL-I).
Add a newline character after each input line to create "double spaced" output:
sed -f 'addnl.sed' input > output
Here, the sed commands are more complicated and stored in a script
file addnl.sed, whose contents are:
a\
(That is, "a\" on the first line, followed by a blank line).
Delete lines in a range. This example deletes all the message lines in a Microprobe
output file up to the start of the first data output lines (denoted by a line
starting with "Pt #")
sed -e '1,/^Pt #/d' 1174.prb > 1174.data