[mdlug] GNU sed weirdness

Jeff Hanson jhansonxi at gmail.com
Sat Jan 23 21:35:17 EST 2010


On Sat, Jan 23, 2010 at 9:32 PM, Jeff Hanson <jhansonxi at gmail.com> wrote:
> On Sat, Jan 23, 2010 at 9:24 PM, Carl T. Miller <carl at carltm.com> wrote:
>> Jeff Hanson wrote:
>>> without extension.  What I though was the correct form looks like
>>> this:
>>>
>>> sed -n 's/\(.*\)\\\(.*\)\.idx/'"\"$compress_exe\" $compress_opts
>>> \"$target_dir\\"'\2'".$compress_ext"'\" \"\1\\2.*\"/p' $1
>>
>> I think the key part is the \1\\2 which I understand you
>> want to be \1 followed by a \ followed by \2.  If that's
>> right, it is being interpreted as \1, \\ and 2.  Try using
>> \1\\\2 and see it that gets the desired results.
>>
>
> That was a typo I caught that just after I posted.  The earlier
> $target_dir"'\2 section was the one I was having problems with.
>

I meant $target_dir\\"'\2'" (the other was my corrected version which
had the backslash in the variable instead)



More information about the mdlug mailing list