help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Editfiles ReplaceAll with Non Alpha Characters


From: Brian E. Seppanen
Subject: Re: Editfiles ReplaceAll with Non Alpha Characters
Date: Fri, 21 Feb 2003 09:32:29 -0500 (EST)

On Fri, 21 Feb 2003, Brian E. Seppanen wrote:

> Hi Folks:
> 
> I'm trying to modify a file that has some contact information used by a 
> dialup modem for paging.    When updating some locations I need a dial 
> prefix, In other locations specific paging providers have to have an area 
> code.   
> 
> Basically what I'm trying to match and replace on has some non alpha 
> characters.   How can I escape these so they are interpreted correctly.  
> 
>        { /etc/file
>                 ReplaceAll phone= With phone=9,
>                 ReplaceAll ttyS1 With ttyS0
>         }

After reading the documentation a bit I realized the errors of my way.   
Unfortunately I'm still coming up a bit short.

        { /etc/file
                ReplaceAll "phone=555-1212" With "phone=155-555-1212"
                ReplaceAll "phone=" With "phone=9\,"
                ReplaceAll "modem=ttyS1" With "modem=ttyS0"
                ReplaceAll "device=ttyS1" With "device=ttyS0"
        }

If I were to use 

ReplaceAll "phone=*" With "phone=9\,"

I need to find some way to match the generic string, and replace with it.   

Perhaps an easier method of doing so would be using /usr/local/bin/rpl 
from a shellcommand, but that suffers from the fact that I have to quote 
the two arguments in the shellcommand definition and leads to parsing 
errors.

i.e "/usr/local/bin/rpl "phone=" "phone=9," /etc/file"

Is there a way to escape quotes within a shellcommand definition?


Thanks,
        

Brian Seppanen
seppy@chartermi.net
906-228-4226 ext 23






reply via email to

[Prev in Thread] Current Thread [Next in Thread]