<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" <ron@wellsted.org.uk><br>To: "Wolverhampton Linux User Group" <wolves@mailman.lug.org.uk><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:
> 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@geek-web.co.uk>
> To: wolves@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 <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>