Re: sed and quoting issue
- From: trighole <fabrice.bernardgranger@xxxxxxxxx>
- Date: Wed, 11 Aug 2010 07:49:55 -0700 (PDT)
On Aug 11, 4:33 pm, Janis Papanagnou <janis_papanag...@xxxxxxxxxxx>
wrote:
trighole schrieb:
On Aug 11, 2:38 pm, Ed Morton <mortons...@xxxxxxxxx> wrote:
On 8/11/2010 7:08 AM, trighole wrote:
Hello,What error? Copy/paste what you get when you execute the script.
I'd like to execute it:
sed -e "s#\(^\.INCLUDE[ \t]*\"\).*\(noMisMatch\)#\1$MODEL_DIR\2#g"
totoFile> titiFile
The problem is coming from \" which generate an error.
The first pattern i would like to catch is: .INCLUDE " which is inWhat you posted looks fine and works for me:
regexp \(^\.INCLUDE[ \t]*\"\), but " is generated problem with sed
if i use single quote like this
sed -e 's#\(^\.INCLUDE[ \t]*\"\).*\(noMisMatch\)#\1${MODEL_DIR}\2#g'
totoFile> titiFile
I do not have problem to catch " but the $MODEL_DIR is not substitute
by the righ value.
can yoiu help me.
$ MODEL_DIR=abc
$ cat file
.INCLUDE " bar noMisMatch
$ sed -e "s#\(^\.INCLUDE[ \t]*\"\).*\(noMisMatch\)#\1$MODEL_DIR\2#g" file
.INCLUDE "abcnoMisMatch
Regards,
Ed.
I am in csh, and you seem in sh, perhaps that is why it is not working
So you seem to have found the solution yourself; first type sh then type
your sed command.
Janis
I'd prefer to exut this sed in CSH, as it is in a csh script and
embeded in a loop, it could slow the process to switch from csh to sh
multiple times
fab
.
- Follow-Ups:
- Re: sed and quoting issue
- From: Maxwell Lol
- Re: sed and quoting issue
- From: Janis Papanagnou
- Re: sed and quoting issue
- References:
- sed and quoting issue
- From: trighole
- Re: sed and quoting issue
- From: Ed Morton
- Re: sed and quoting issue
- From: trighole
- Re: sed and quoting issue
- From: Janis Papanagnou
- sed and quoting issue
- Prev by Date: Re: sed and quoting issue
- Next by Date: Re: Generating data depending upon the given size
- Previous by thread: Re: sed and quoting issue
- Next by thread: Re: sed and quoting issue
- Index(es):
Relevant Pages
|