[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lugbe] grep command



On Thu, Jul 18, 2002 at 01:54:26PM +0200, wn wrote:
> Hallo zäme,
> 
> ein Anfänger am verzweifeln...
> 
> Ich versuche folgendes grep zu machen:
> 
> grep -c 'rc=127' filename
> 
> Zurück kommt "0" (lines) found.
> 
> Das file hat 70 lines (wc -l filename) und die Textstelle "rc=127" kommt ein
> paar mal vor. Hier eine Linie:
> 
> (6)mi=185400/po=23/(4)cl=/(4)vs=/(18)cg=bla at bla.ch/(6)ni=Server/ty=12/it=5/e
> t=2/(12)de=+41791234567/sz=5448/(4)id=3727/pt=1/
> to=20020718T070054Z/rt=20020718T070054Z/mp=1/mc=1/(35)mo=application/vnd.wap
> .multipart.mixed/nn=1/(8)in=ST1 XYZ/(7)ci=msghdlr/rc=12
> 7/ch=2/ed=1/

Im obigen Beispiel ist die 7 auf einer neuen Zeile, das heist 127 gibt
es nicht. Folgendes würde Dein Problem lösen:

$ cat filename | tr -d "\n" | grep -c "rc=127"
1
$


Gruss,
Patrik