What I have does not work, and I need some assistance.
Your help is appreciated.
Thanks.
--
My editor cut off some of the text, I assume due to line being too long.
Hopefully it is clear what I am trying to accomplish with the incomplete
information above
Thanks.
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
02-12-2008, 10:34 PM
"Herta Van den Eynde"
SED help
On 13/02/2008, Scott Ruckh <sruckh@gemneye.org> wrote:
> I would like to do the following SED replacement, but I am not having much
> luck and thought I would ask for help.
>
> TEXT1="some-text a.b.c.d a.b.c.d a.b.c.d a.b.c.d"
> TEXT2="some-text 1.1.1.1 2.2.2.2 3.3.3.3 4.4.4.4"
>
> sed -i "s/$TEXT1/$TEXT2/g" $INFILE
>
> ;a.b.c.d are unknown IP Addresses.
>
> ----------------------
>
> I have tried this:
>
> TEXT2="some-text 1.1.1.1 2.2.2.2 3.3.3.3 4.4.4.4"
> IP_REGEX="(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][$
> TEXT1="^some-text[ ]${IP_REGEX}[ ]${IP_REGEX}[ ]${IP_REGEX}[
> ]${IP_REGEX}"
>
> sed -i "s/$TEXT1/$TEXT2/g" $INFILE
>
> ----------------------
>
> What I have does not work, and I need some assistance.
>
> Your help is appreciated.
>
> Thanks.
>
I think you simply missed out on the option: -e instead of -i. This
works for me:
Herta
--
"Life on Earth may be expensive,
but it comes with a free ride around the Sun."
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
02-13-2008, 12:30 AM
"Scott Ruckh"
SED help
This is what you said Herta Van den Eynde
> On 13/02/2008, Scott Ruckh <sruckh@gemneye.org> wrote:
>> I would like to do the following SED replacement, but I am not having
>> much
>> luck and thought I would ask for help.
>>
>> TEXT1="some-text a.b.c.d a.b.c.d a.b.c.d a.b.c.d"
>> TEXT2="some-text 1.1.1.1 2.2.2.2 3.3.3.3 4.4.4.4"
>>
>> sed -i "s/$TEXT1/$TEXT2/g" $INFILE
>>
>> ;a.b.c.d are unknown IP Addresses.
>>
>> ----------------------
>>
>> I have tried this:
>>
>> TEXT2="some-text 1.1.1.1 2.2.2.2 3.3.3.3 4.4.4.4"
>> IP_REGEX="(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][$
>> TEXT1="^some-text[ ]${IP_REGEX}[ ]${IP_REGEX}[ ]${IP_REGEX}[
>> ]${IP_REGEX}"
>>
>> sed -i "s/$TEXT1/$TEXT2/g" $INFILE
>>
>> ----------------------
>>
>> What I have does not work, and I need some assistance.
>>
>> Your help is appreciated.
>>
>> Thanks.
>>
> I think you simply missed out on the option: -e instead of -i. This
> works for me:
>
> TEXT1="some-text a.b.c.d a.b.c.d a.b.c.d a.b.c.d"
> TEXT2="some-text 1.1.1.1 2.2.2.2 3.3.3.3 4.4.4.4"
>
> sed -e "s/$TEXT1/$TEXT2/g" $INFILE
>
Here is the poorly coded version I ended up with...
This is going to be used to dynamically update my openvpn configuration
server configuration.
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
02-13-2008, 12:50 AM
mark
SED help
Scott Ruckh wrote:
> I would like to do the following SED replacement, but I am not having much
> luck and thought I would ask for help.
>
> TEXT1="some-text a.b.c.d a.b.c.d a.b.c.d a.b.c.d"
> TEXT2="some-text 1.1.1.1 2.2.2.2 3.3.3.3 4.4.4.4"
>
> sed -i "s/$TEXT1/$TEXT2/g" $INFILE
>
> ;a.b.c.d are unknown IP Addresses.
I believe, given what you say above, that you'd get
some-text 1111 1111 1111 1111
mark
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
03-09-2010, 03:56 PM
chloe K
sed help
Hi
Can I know how to use sed to substitue 2 instead of 1 at the same time?
eg:
sed 's/pchloe.com/abc.com/ ; /192.92.123.5/10.10.0.3/g' orgfile >> newfile
thank you
__________________________________________________ ________________
Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with the All-new Yahoo! Mail. Click on Options in Mail and switch to New Mail today or register for free at http://mail.yahoo.ca
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
03-09-2010, 04:08 PM
Paul Heinlein
sed help
On Tue, 9 Mar 2010, chloe K wrote:
> Hi
>
> Can I know how to use sed to substitue 2 instead of 1 at the same time?
>
> eg:
>
> sed 's/pchloe.com/abc.com/ ; /192.92.123.5/10.10.0.3/g' orgfile >> newfile
sed
-e 's/pchloe.com/abc.com/g'
-e 's/192.92.123.5/10.10.0.3/g'
orgfile >> newfile
--
Paul Heinlein <> heinlein@madboa.com <> http://www.madboa.com/
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
03-09-2010, 04:13 PM
Dan Burkland
sed help
> -----Original Message-----
> From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On
> Behalf Of Paul Heinlein
> Sent: Tuesday, March 09, 2010 11:08 AM
> To: CentOS mailing list
> Subject: Re: [CentOS] sed help
>
> On Tue, 9 Mar 2010, chloe K wrote:
>
> > Hi
> >
> > Can I know how to use sed to substitue 2 instead of 1 at the same time?
> >
> > eg:
> >
> > sed 's/pchloe.com/abc.com/ ; /192.92.123.5/10.10.0.3/g' orgfile >>
> newfile
>
> sed
> -e 's/pchloe.com/abc.com/g'
> -e 's/192.92.123.5/10.10.0.3/g'
> orgfile >> newfile
>
> --
> Paul Heinlein <> heinlein@madboa.com <> http://www.madboa.com/
> _______________________________________________
> CentOS mailing list
> CentOS@centos.org
> http://lists.centos.org/mailman/listinfo/centos
You can also use semi colons for example:
sed 's/pchloe.com/abc.com/; s/192.92.123.5/10.10.0.3/g' orgfile >> newfile
Dan
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos