Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site geowhiz.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!uwvax!geowhiz!larry From: larry@geowhiz.UUCP (Larry McVoy) Newsgroups: net.unix Subject: YA{sed}{question} Message-ID: <294@geowhiz.UUCP> Date: Wed, 20-Nov-85 03:48:11 EST Article-I.D.: geowhiz.294 Posted: Wed Nov 20 03:48:11 1985 Date-Received: Sat, 23-Nov-85 00:18:43 EST Reply-To: larry@geowhiz.UUCP (Larry McVoy) Organization: UW Madison, Geology Dept. Lines: 28 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@rsch.wisc.edu | keep right | Uucp: {seismo, ihnp4}!uwvax!geowhiz!geophiz!larry +----------------+