Unix Shell - Re: How to grep for text1 and text2 and text3 on three different

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > November 2004 > Re: How to grep for text1 and text2 and text3 on three different





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: How to grep for text1 and text2 and text3 on three different
Robert Katz

2004-11-27, 5:51 pm

rakesh sharma wrote:
> Robert Katz <katz@hp.com> wrote in message news:
>
>
>
>
>
> case `
> sed -e '
> /Net/!d
> $d;N;/\nTare$/!D
> $d;N;/\nGross$/!D
> s/.*/1/
> ' < yourfile
> ` in
> 1) true;;
> *) false;;
> esac


It won't work for

xNet
xTare
XGross


#!/usr/bin/sed -nf
:x
/Net/{
n
/Tare/!bx
n
/Gross/!bx
s/.*/0/p
q
}
$s/.*/1/p
#####

[ . . . ]

--
Regards,

---Robert
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com