[comp.unix.wizards] global replacements with sed

srh@docwrk.UUCP (Steven R. Houser) (08/11/89)

I'm trying to use the sed editor to make global relacements, but I'm not
having much luck.  I tried RTFM, but it doesn't give an example of what the
script file should look like.  What I'm trying to do is replace occurrences 
of ^L with .bp macros.

When I use the a script file containing:

	/^L/s//\.bp

I get a message saying "sed: command line garbled".  What am I doing wrong?
What should the script look like?  

Steve 
-- 
Steven R. Houser    The Document Workshop | "Man is the only animal who
					  |  laughs--or needs to."
srh@docwrk.UUCP      CompuServe 71401,373 | 
uunet!osu-cis!n8emr!uncle!oink!docwrk!srh |                  Mark Twain

grr@cbmvax.UUCP (George Robbins) (08/11/89)

In article <49@docwrk.UUCP> srh@docwrk.UUCP (Steven R. Houser) writes:
> I'm trying to use the sed editor to make global relacements, but I'm not
> having much luck.  I tried RTFM, but it doesn't give an example of what the
> script file should look like.  What I'm trying to do is replace occurrences 
> of ^L with .bp macros.
> 
> When I use the a script file containing:
> 
> 	/^L/s//\.bp
> 
> I get a message saying "sed: command line garbled".  What am I doing wrong?
> What should the script look like?  

sed -e '/^L/s//.bp/' should work, assuming it's a real control/l and not
some kind of caret followed by an L.

-- 
George Robbins - now working for,	uucp: {uunet|pyramid|rutgers}!cbmvax!grr
but no way officially representing	arpa: cbmvax!grr@uunet.uu.net
Commodore, Engineering Department	fone: 215-431-9255 (only by moonlite)

decot@hpisod2.HP.COM (Dave Decot) (08/12/89)

The problem is that sed does not know how to infer the final slash
when you leave it out.  ex/vi and ed both know to add the trailing slash,
but sed doesn't.

Dave

vause@cs-col.Columbia.NCR.COM (Sam Vause) (08/12/89)

In article <7630@cbmvax.UUCP> grr@cbmvax.UUCP (George Robbins) writes:
>In article <49@docwrk.UUCP> srh@docwrk.UUCP (Steven R. Houser) writes:
>> I'm trying to use the sed editor to make global relacements, but I'm not
>> having much luck.  I tried RTFM, but it doesn't give an example of what the
>> script file should look like.  What I'm trying to do is replace occurrences 
>> of ^L with .bp macros.
>> 
>> When I use the a script file containing:
>sed -e '/^L/s//.bp/' should work, assuming it's a real control/l and not
>some kind of caret followed by an L.

How about:  $ sed "s/^L/.bp/g" filename......


+------------------------------------------------------------------+
|Sam Vause, NCR Corporation, Customer Services - TOWER Support	   |
|3325 Platt Springs Road, West Columbia, SC 29169 (803) 791-6953   |
|                                vause@cs-col.Columbia.NCR.COM     |
|			 ...!uunet!ncrlnk!ncrcae!cs-col!vause	   |
|		...!ucbvax!sdcsvax!ncr-sd!ncrcae!cs-col!vause      |
+------------------------------------------------------------------+