Mailinglist Archive: opensuse-programming-de (174 mails)

< Previous Next >
Re: grep Frage
  • From: David Haller <lists@xxxxxxxxxx>
  • Date: Tue, 20 Jan 2004 23:03:09 +0100
  • Message-id: <20040120220309.GA31711@xxxxxxxxxxxxxxxxxx>
Hallo,

Am Tue, 20 Jan 2004, Thomas Moritz schrieb:
>ich hatte gerade bezueglich einer Mail in suse-ml
>etwas probiert und komme direkt ins Gruebeln:
>Angenommen in Datei test.txt stehen jeweils am Zeilenanfang die
>folgenden Zeichen:
>1 2 3 4 5 6 7 8 9 0 #
>
>Test1:
>grep -v [1,3,5,9,\#] test.txt

Wozu hast du hier mehrere Kommata?

>liefert das richtige Ergebnis!
>1 3 5 9 # werden gefiltert
>
>Test2:
>grep -v [1,2,3,5,9,\#] test.txt
>geht voll in die Hosen! Es wird lediglich die Zeile mit
>der 2 gefiltert. Welche Erklaerung gibt es hierfuer?

Keine. Hier klappts.

$ { seq 0 9; echo "#"; } | grep -v [1,3,5,9,\#] | xargs echo
0 2 4 6 7 8
$ { seq 0 9; echo "#"; } | grep -v [1,2,3,5,9,\#] | xargs echo
0 4 6 7 8

-dnh

--
If human beings don't keep exercising their lips, he thought, their mouths
probably seize up. After a few months' consideration and observation he
abandonded this theory in favor of a new one. If they don't keep on
exercising their lips, he thought, their brains start working. -- THHGTTG

< Previous Next >
Follow Ups
References