Re: ls | grep
On 07.01.06 14:50:09, Al Bogner wrote:
> Am Samstag, 7. Januar 2006 14:45 schrieb Al Bogner:
>
> > Ich vermute, dass mir der 1. Punkt noch Probleme machen wird.
> >
> > Ich habe noch immer nicht rausgefunden, warum die "Oder-Syntax" nur mit 1
> > Zeichen funktioniert.
> >
> > find -maxdepth 1 ! -regex ".*_[cd|ef]$" -printf "%f\n"
> > .
> > a_1
> > a_2
> > a
> > datei
> > a_kb
> > a_cd
> > a_ef
> >
> > a_cd und a_ef sollten also nicht gelistet werden.
>
>
> find -maxdepth 1 -type d ! -regex ".*[_cd|_ef]$" -printf "%f\n"
Ah, da hab ich grad wieder was gelernt, also vergiss die Kommentare
bzgl. [] in meiner anderen Antwort. | hat offensichtlich hoehere
Prioritaet und verliert seine spezielle Funktion in [] nicht. Aber bei
mir funktioniert auch:
andreas@morpheus:~>echo -ne "te_st\nyg_hj\ngh_gf" | grep "_[st|hj]"
te_st
yg_hj
Allerdings geht:
andreas@morpheus:~>echo -ne "te_st\nyg_hj\ngh_gf" | grep "^.*_[st|hj]$"
nicht. Warum weiss ich so aber auch nicht.
> Es bleibt also der Punkt. Kann man den ohne weitere Pipe entfernen?
Klaro mache eine 2. regex fuer find:
find ... ! -regex "^\.$"
Andreas
--
You will be run over by a bus.
Reply to:
- References:
- ls | grep
- From: Al Bogner <debian@ml05a.pinguin.uni.cc>
- Re: ls | grep
- From: Daniel Leidert <daniel.leidert.spam@gmx.net>
- Re: ls | grep
- From: Al Bogner <debian@ml05a.pinguin.uni.cc>
- Re: ls | grep
- From: Al Bogner <debian@ml05a.pinguin.uni.cc>