From: simonp on
I have a sed script that I need to add a pattern matching one of
two choices (.rar or .zip). I know this can be done in awk and
egrep with (rar|zip), but is there anyway to get this behaviour
in sed?

Do I have to rewrite my script in perl?

Cheers,
Simon

From: mop2 on
don't work /zip\|rar/ with sed?


sim...(a)nospam.com wrote:
> I have a sed script that I need to add a pattern matching one of
> two choices (.rar or .zip). I know this can be done in awk and
> egrep with (rar|zip), but is there anyway to get this behaviour
> in sed?
>
> Do I have to rewrite my script in perl?
>
> Cheers,
> Simon
From: Rajan on


<simonp(a)nospam.com> wrote in message news:fuogva$ejs$1(a)reader2.panix.com...
> I have a sed script that I need to add a pattern matching one of
> two choices (.rar or .zip). I know this can be done in awk and
> egrep with (rar|zip), but is there anyway to get this behaviour
> in sed?
>
> Do I have to rewrite my script in perl?
>
> Cheers,
> Simon
>

I use gnu sed (if I have to) and I can say -r to make sed understand
extended regex. Alternatively, I can write it the script twice with -e with
different regexs (I won't do it). Calling sed experts....

From: Maxwell Lol on
simonp(a)nospam.com writes:

> Do I have to rewrite my script in perl?

It's not too bad if you have to, using s2p (part of perl).
From: simonp on
Rajan <rsharma(a)nodomain.no> wrote:
>
>
> <simonp(a)nospam.com> wrote in message news:fuogva$ejs$1(a)reader2.panix.com...
>> I have a sed script that I need to add a pattern matching one of
>> two choices (.rar or .zip). I know this can be done in awk and
>> egrep with (rar|zip), but is there anyway to get this behaviour
>> in sed?
>>
>> Do I have to rewrite my script in perl?
>>
>> Cheers,
>> Simon
>>
>
> I use gnu sed (if I have to) and I can say -r to make sed understand
> extended regex. Alternatively, I can write it the script twice with -e with
> different regexs (I won't do it). Calling sed experts....
>

This is the solution. The -r option (-E in my FreeBsd shell
account) enables extended pattern regex.

I actually looked this up in Linux in a Nutshell from O'Reilly.
They have a grid with all the utilities like ed, awk, grep, sed
and what they can do. Extended regex was *not* tagged for sed,
though it was for grep. (Though it is there in the dedciated
chapter on sed). Must be an error.

Thanks again,
Simon