Complete.Org: Mailing Lists: Archives: discussion: August 1999:
Re: [aclug-L] sed question
Home

Re: [aclug-L] sed question

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: aclug-L@xxxxxxxxxxxx
Subject: Re: [aclug-L] sed question
From: Wayne White <wwhite@xxxxxxxxxxxxx>
Date: Mon, 23 Aug 1999 15:06:59 -0500
Reply-to: aclug-L@xxxxxxxxxxxx

Sanjay,

Thanks so much for all the help. I just successfully updated my web page
with a shell script. I really appreciate it. 

Wayne


At 08:57 AM 8/23/1999 -0500, you wrote:
>
>On Sun, 22 Aug 1999, Wayne White wrote:
>
>> I am trying to get sed to substitute the value of a  variable for 
>> another string. It doesn't seem to want to do it as it only 
>> substitutes "$vari" instead of the value of var.
>> 
>> Is it even possible to use a variable in sed like this? Is there
>> some special syntax required if it is possible. 
>> 
>> Here's what I've tried,
>> 
>> # Get current dynamic local IP address
>> 
>> vari= `tail /var/log/messages | grep local | awk '{ print $9 }'`
>> 
>> # Substitute it into a html file in place of last IP address
>> 
>> sed 's/209\.134\.90\.[0-9]*/$vari/' /temp/test.html > /temp/test2.html
>> 
>> This will insert "$vari" into the correct place in the html file,
>> but I need it to place the value of vari instead. No matter what I
>> put between the /  and   /, that is what it substitutes into the 
>> test2.html file. 
>> 
>
>Try using double quotes instead of single quotes for the sed command.
>Good luck.
>
>----------------------------------------------------------------------------
>
>      SANJAY DHAR
>
>      sxdhar@xxxxxxxxxxx
>
>      http://www.cs.twsu.edu/~sxdhar
>
>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++
>
>
>

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Just allow a fragment of your life. . .
        to wander free.
                E.J.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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