[plug] sed - syntax problem ???
Arie Hol
arie99 at ozemail.com.au
Sat Jun 16 00:30:17 WST 2007
On 15 Jun 2007 at 20:57, Kirk Turner wrote:
> On 6/15/07, Arie Hol <arie99 at ozemail.com.au> wrote:
> >
> > I am learning to use sed on my Windows box (part of the Gnu Utilities
> > package for Windows)
> Yes I love sed too. Very useful tool.
> > sed -ie s/_uacct = "UA-288334-4";// *.html
>
> Are you running that exact command (cut and paste) on the command
> line? If so then the semicolon will terminate the command at that
> point - hence no terminating slash for the sed expression.
>
Good point with that one - but it doesn't hold up - because I use one
command with a semi colon in the target string - and that one runs
without incident and it does what I wanted it to do.
e.g.
sed -ie s/urchinTracker();// *.html
> You can try quoting the whole lot:
>
> sed -ie "s/_uacct = \"UA-28833404\";//" *.html
>
> That should hopefully fix what you are seeing.
>
Thanks for that, Kirk.
Quoting the entire substitution expression was only part of the solution,
It removed the error message but did not have the desired effect of
removing the target string.
I also had to escape the internal set of double quotes as below :
sed -ie "s/_uacct \= \"UA-288334-4\";//" *.html
The batch file now works as desired.
sed is my new friend, when run from the batch file it saves me from
transferring all the HTML files to my linux box - then running the
commands through a script and then transferring the files back to the
Windows box.
It would probably make better sense to do it all on the Linux box in the
first place, but the files are required by my wife and kids - and they
won't use Linux because they prefer Windows.
Regards Arie
------------------------------------------------------------------
For the concert of life, nobody has a program.
------------------------------------------------------------------
More information about the plug
mailing list