Sed question

From: Robert Gease (robert_gease_at_yahoo.com)
Date: 12/18/03


Date: 18 Dec 2003 08:57:53 -0800

I tested something I ripped from the O'Reilly book..

If I run as a script. ie sed -f flip flip.text
flip:
'/1/{
h
d
}
/2/{
G
}'

flip.text:
1
2
11
22
111
222
it works fine and flips the lines containing 1 and 2, but

sed '/1/{h;d;};/2/{G;}' flip.text
Doesn't work. ie. replacing new lines with ";".

But if I add <CTRL-J> for ";" it works.
sed '/1/{^Jh^Jd^J}^J/2/{^JG^J}' flip.text

Anybody know whats going on.. since I often see sed
scripts that I want to transfer them to the command line.

Thanks
Rob



Relevant Pages