Hi all,
I am learning to use sed and have a hypothetical requirement:
bash$ cat states
California
Massachusetts
Arizona
Wisconsin
I would like the output: (Basically I want only one blank line in between)
California
Massachusetts
Arizona
Wisconsin
Please suggest ways to do it with sed. Should it use concept of multiline pattern space etc.
Thanks,
Jagrati
In response to one of the comments, Ok, I ran some test scripts, and I was wrong with hypopthesis that address space selection criteria is applied only once. It seems to get activated again and again.
bash$ cat file
a
b
c
a
b
c
bash$ sed -e '/a/,/b/s/$/x/g' file
ax
bx
c
ax
bx
c
I had the impression that it would yield:
ax
bx
c
a
b
c
So could someone please explain how the sed proceeds in case of comma separated address spaces.