Sed adding and stripping [ and ]
Hello,
I am being really dumb today. I can get perl to do it but I really need
to get things working with sed. I have a script that is pasrsing input
and what I get is
[xxx.xxx.xxx.xxx] or [ip6-address]
What I need to do is remove the [ and ] so I and use the list generated to
do ipf rules. Then later I need to add them when I have ip's rather than
fully qualified domain names to send mail. I am able to do this in perl,
but I really need to stay in in the shell. The output above is from an
awk command.
Could someone assist. It seems my sed is way to rusty.
Thanks,
--
Boyd Gerber <gerberb@zenez.com>
ZENEZ 1042 East Fort Union #135, Midvale Utah 84047
Re: Sed adding and stripping [ and ]
On Fri, May 02, 2008, Boyd Lynn Gerber wrote:[color=blue]
>Hello,
>
>I am being really dumb today. I can get perl to do it but I really need
>to get things working with sed. I have a script that is pasrsing input
>and what I get is
>
>[xxx.xxx.xxx.xxx] or [ip6-address]
>
>What I need to do is remove the [ and ] so I and use the list generated to
>do ipf rules. Then later I need to add them when I have ip's rather than
>fully qualified domain names to send mail. I am able to do this in perl,
>but I really need to stay in in the shell. The output above is from an
>awk command.
>
>Could someone assist. It seems my sed is way to rusty.[/color]
This should do it (I tried s/[\[\]]//g but that didn't work for me).
sed -e 's/\[//g' -e 's/\]//g'
Bill
--
INTERNET: [email]bill@celestial.com[/email] Bill Campbell; Celestial Software LLC
URL: [url]http://www.celestial.com/[/url] PO Box 820; 6641 E. Mercer Way
Voice: (206) 236-1676 Mercer Island, WA 98040-0820
Fax: (206) 232-9186
If you make yourselves sheep, the wolves will eat you -- Benjamin Franklin
Re: Sed adding and stripping [ and ]
On Fri, 2 May 2008, Bill Campbell wrote:[color=blue]
> On Fri, May 02, 2008, Boyd Lynn Gerber wrote:[color=green]
> >I am being really dumb today. I can get perl to do it but I really need
> >to get things working with sed. I have a script that is pasrsing input
> >and what I get is
> >
> >[xxx.xxx.xxx.xxx] or [ip6-address]
> >
> >What I need to do is remove the [ and ] so I and use the list generated to
> >do ipf rules. Then later I need to add them when I have ip's rather than
> >fully qualified domain names to send mail. I am able to do this in perl,
> >but I really need to stay in in the shell. The output above is from an
> >awk command.
> >
> >Could someone assist. It seems my sed is way to rusty.[/color]
>
> This should do it (I tried s/[\[\]]//g but that didn't work for me).
>
> sed -e 's/\[//g' -e 's/\]//g'[/color]
Thanks, that works for stripping.
Thanks,
--
Boyd Gerber <gerberb@zenez.com>
ZENEZ 1042 East Fort Union #135, Midvale Utah 84047
Re: Sed adding and stripping [ and ]
Boyd Lynn Gerber wrote (on Fri, May 02, 2008 at 06:06:44PM -0600):
| Hello,
|
| I am being really dumb today. I can get perl to do it but I really need
| to get things working with sed. I have a script that is pasrsing input
| and what I get is
|
| [xxx.xxx.xxx.xxx] or [ip6-address]
|
| What I need to do is remove the [ and ] so I and use the list generated to
| do ipf rules. Then later I need to add them when I have ip's rather than
| fully qualified domain names to send mail. I am able to do this in perl,
| but I really need to stay in in the shell. The output above is from an
| awk command.
Why not remove them in the AWK code before writing them out?
| Could someone assist. It seems my sed is way to rusty.
|
| Thanks,
|
| --
| Boyd Gerber <gerberb@zenez.com>
| ZENEZ 1042 East Fort Union #135, Midvale Utah 84047
Bob
--
Bob Stockler +-+ [email]bob@trebor.iglou.com[/email] +-+ [url]http://members.iglou.com/trebor[/url]