YA{sed}{question}

Larry McVoy larry at geowhiz.UUCP
Wed Nov 20 18:48:11 AEST 1985


Seeing as everyone is brushing off their 'sed-wizard' hats, I've a question
too:

[input]
{garbage}#{complete garbage}#{more garbage}
....

[desired output]
{garbage}#{complete garbage}{more garbage}
....

What I want is to find a string delimited by starting and ending '#'s, and
strip off the last '#' (don't ask way, it had something to do with making
a grammer input human-readable).  Sed gives me the option of including
the address string in the substitution string, but not part of it.  Example:

s/#[^#]*#/&YUCK/g

should give me "#{complete garbage}#YUCK".  I've been doing this, then a

s/#YUCK//g

to strip off the trailing '#'.  Does anyone have a better solution?
-- 
Larry McVoy						+----------------+
							| Slower traffic |
Arpa:	mcvoy at rsch.wisc.edu				|   keep right	 |
Uucp:	{seismo, ihnp4}!uwvax!geowhiz!geophiz!larry	+----------------+



More information about the Comp.unix mailing list