[Wolves] Sed help.

Ron Wellsted ron at wellsted.org.uk
Fri Jun 20 11:41:32 BST 2008


On Fri, Jun 20, 2008 at 11:28:48AM +0100, Simon C. Burke wrote:
> In the end I replaced the sing quotes with double quotes and escaped them with the good old backslash. 
> Now I just need to find how to add tot he start. 
> 
> 
> ----- Original Message ----- 
> From: "Simon C. Burke" <simonb at geek-web.co.uk> 
> To: wolves at mailman.lug.org.uk 
> Sent: Friday, 20 June, 2008 11:11:20 AM GMT +00:00 GMT Britain, Ireland, Portugal 
> Subject: [Wolves] Sed help. 
> 
> 
> I have a text file with some 18000 lines and i need to ammend something to the start and end. For the end I have: 
> 
> sed 's/$/Add Text to end"/g' myfile 
> 
> However the text I'm adding is: 
> 
> ' |grep -vir 'http://' >> test.txt 
> 
> 
> The issue I have is that how do I now escape the pipe and inverted comma's? 
> 
> Any idea's?? 

Glad you found a solution to your first problem

There was an simpler solution : use a script file  which you invoke
with the -f switch (eg sed -f script.sed infile >outfile)

This way you do not need to worry about shell escapes.


The normal RE char for the begining of a line is the caret ^


HTH

-- 
Ron Wellsted
ron at wellsted.org.uk http://www.wellsted.org.uk
N 52.567623, W 2.136111 Linux Counter No. 202120
Ekiga: 645022
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 483 bytes
Desc: Digital signature
Url : http://mailman.lug.org.uk/pipermail/wolves/attachments/20080620/f9f33655/attachment.bin


More information about the Wolves mailing list