some sed examples

In sed you start with either a line range, single or starting,ending
1,$    whole buffer
1,2    lines one and two
3    line three
1d    delete first line

or a pattern to match(RE), but you can't do this and the above on the same line, altho s might get you somewhere.

# trim trailing spaces, note the s// matches what matched.
/ $/s///

# delete empty lines

# replace _ with -

# change the name of an oldarray to newarray, preserving index arg

Allen notes from the  Saint Louis Unix Users Group  meeting Apr 8th 2002
# change subject line in a mail folder
/^Subject:/s/old way to versbose stuff/consise/

# Join the next line (join lines)
N;s/\n/ /