The solution to the sed - multiple lines problem

chris at mimsy.UUCP chris at mimsy.UUCP
Thu Mar 12 18:32:59 AEST 1987


In article <574 at hao.UCAR.EDU> bill at hao.UCAR.EDU (Bill Roberts) writes:
>The following sed script does the job:

>/one/!b
>N
>/two/!b
>N
>/three/!b
>s/\n/, /g 

Alas, this script fails to convert the input

	one
	one
	two
	three
	four

to

	one
	one, two, three
	four

While I think it is possible to handle this case, and its counterpart
`one\ntwo\none\ntwo\nthree', I am not going to work on it.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP:	seismo!mimsy!chris	ARPA/CSNet:	chris at mimsy.umd.edu



More information about the Comp.unix.questions mailing list