|
From: simonp on 23 Apr 2008 19:32 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 23 Apr 2008 19:51 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 23 Apr 2008 20:13 <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 23 Apr 2008 21:20 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 23 Apr 2008 22:05 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
|
Next
|
Last
Pages: 1 2 Prev: China OEM Microphone - OEM OEM Microphone Manufacturer Next: grep doubt |