Re: bash quoting problems

2011-08-10 Thread Andreas Berglund
On 2011-08-10 07:46, Ivan Shmakov wrote: Andreas Berglund writes: > I have a problem with the following sed snippet > sed -i s"|^\( *PATH="\)\(.*\)|\1$ADD:\2|" ~/profile-test > I need soft quotes in order for $ADD to expand and I also need to > math against one doublequote in the

Re: bash quoting problems

2011-08-10 Thread Andreas Berglund
On 2011-08-10 00:43, Bob McGowan wrote: On 08/08/2011 04:43 PM, Andreas Berglund wrote: Hi! I have a problem with the following sed snippet sed -i s"|^\( *PATH="\)\(.*\)|\1$ADD:\2|" ~/profile-test I need soft quotes in order for $ADD to expand and I also need to math against one doublequote in t

Re: bash quoting problems

2011-08-10 Thread Andreas Berglund
On 2011-08-09 01:51, Bob Proulx wrote: sed -i s"|^\( *PATH=\"\)\(.*\)|\1$ADD:\2|" ~/profile-test The above seems like you are doing more than you need with the long match for (.*) and \2. It isn't needed. It is much more efficient to avoid matching a potentially infinite amount of data.

Re: bash quoting problems

2011-08-10 Thread Ivan Shmakov
> thomas kral writes: >>> I have a problem with the following sed snippet >>> sed -i s"|^\( *PATH="\)\(.*\)|\1$ADD:\2|" ~/profile-test >>> I need soft quotes in order for $ADD to expand and I also need to math >>> against one doublequote in the regexp in for $ADD to be put in the >>> c

Re: bash quoting problems

2011-08-10 Thread thomas . kral
> Hi! > I have a problem with the following sed snippet > sed -i s"|^\( *PATH="\)\(.*\)|\1$ADD:\2|" ~/profile-test > I need soft quotes in order for $ADD to expand and I also need to math > against one doublequote in the regexp in for $ADD to be put in the > corrct place. Does anyone know how to d

Re: bash quoting problems

2011-08-09 Thread Ivan Shmakov
> Andreas Berglund writes: > I have a problem with the following sed snippet > sed -i s"|^\( *PATH="\)\(.*\)|\1$ADD:\2|" ~/profile-test > I need soft quotes in order for $ADD to expand and I also need to > math against one doublequote in the regexp in for $ADD to be put in > the corrct

Re: bash quoting problems

2011-08-09 Thread Bob McGowan
On 08/08/2011 04:43 PM, Andreas Berglund wrote: Hi! I have a problem with the following sed snippet sed -i s"|^\( *PATH="\)\(.*\)|\1$ADD:\2|" ~/profile-test I need soft quotes in order for $ADD to expand and I also need to math against one doublequote in the regexp in for $ADD to be put in the co

Re: bash quoting problems

2011-08-08 Thread Bob Proulx
Andreas Berglund wrote: > I have a problem with the following sed snippet > sed -i s"|^\( *PATH="\)\(.*\)|\1$ADD:\2|" ~/profile-test > I need soft quotes in order for $ADD to expand and I also need to > math against one doublequote in the regexp in for $ADD to be put in > the corrct place. Does any

bash quoting problems

2011-08-08 Thread Andreas Berglund
Hi! I have a problem with the following sed snippet sed -i s"|^\( *PATH="\)\(.*\)|\1$ADD:\2|" ~/profile-test I need soft quotes in order for $ADD to expand and I also need to math against one doublequote in the regexp in for $ADD to be put in the corrct place. Does anyone know how to do this?