<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Times New Roman; font-size: 12pt; color: #000000'><br>----- Original Message -----<br>From: "Ron Wellsted" &lt;ron@wellsted.org.uk&gt;<br>To: "Wolverhampton Linux User Group" &lt;wolves@mailman.lug.org.uk&gt;<br>Sent: Friday, 20 June, 2008 11:41:18 AM GMT +00:00 GMT Britain, Ireland, Portugal<br>Subject: Re: [Wolves] Sed help.<br><br>On Fri, Jun 20, 2008 at 11:28:48AM +0100, Simon C. Burke wrote:
&gt; In the end I replaced the sing quotes with double quotes and escaped them with the good old backslash. 
&gt; Now I just need to find how to add tot he start. 
&gt; 
&gt; 
&gt; ----- Original Message ----- 
&gt; From: "Simon C. Burke" <simonb@geek-web.co.uk> 
&gt; To: wolves@mailman.lug.org.uk 
&gt; Sent: Friday, 20 June, 2008 11:11:20 AM GMT +00:00 GMT Britain, Ireland, Portugal 
&gt; Subject: [Wolves] Sed help. 
&gt; 
&gt; 
&gt; 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: 
&gt; 
&gt; sed 's/$/Add Text to end"/g' myfile 
&gt; 
&gt; However the text I'm adding is: 
&gt; 
&gt; ' |grep -vir 'http://' &gt;&gt; test.txt 
&gt; 
&gt; 
&gt; The issue I have is that how do I now escape the pipe and inverted comma's? 
&gt; 
&gt; 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 &gt;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 <br><br>Thanks for that. I worked it out in the end, awk's a bit alien to me at the moment. so im really happy with what I have done so far.<br>The next issue was echoing an incrementing number into test.txt (ie test2.txt, test3.txt) and so forth. I was going to cheat and instead of awking the text to the end, still awk the front ut use a quick bash script to echo the end with the variable in. Ah well the scripts running now. <br><br>Thanks for any time anyone spent on this.<br><br>Regards,<br><br>Simon B<br></simonb@geek-web.co.uk></div></body></html>