grep: teilstrings suchen

Post Reply
Message
Author
niko

grep: teilstrings suchen

#1 Post by niko »

Hallo, ich versuch unterhalb eines verzeichnisses alle dateien zu druchsuchen, in denen "*glib" vorkommt, aber nicht "*glib*", also nicht zum Beispiel "glibc" oder "virtual/glibc", wohl aber "virtual/glib" oder auch nur "glib". Vorzugsweise sogar nur "glib", wenn nur ein sonderzeichen davorsteht (also nicht "abglib", wohl aber eben besagtes "dev-libs/glib").

Wie gehe ich das an, grep -r scheint das nicht zu können.

Max

Re: grep: teilstrings suchen

#2 Post by Max »

man find

gruß

rattengift

Re: grep: teilstrings suchen

#3 Post by rattengift »

man grep:<blockquote><pre><font size="1" face="">code:</font><hr><font face="Courier New" size="2">-w, --word-regexp
Select only those lines containing matches that form whole words. The test is that the matching substring must
either be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be
either at the end of the line or followed by a non-word constituent character. Word-constituent characters are
letters, digits, and the underscore.</font><hr></pre></blockquote>meinst du das?

ich weis es

Re: grep: teilstrings suchen

#4 Post by ich weis es »

find $PATH -iname glib
findet alle dateien namens glib unterhalb $PATH

rattengift

Re: grep: teilstrings suchen

#5 Post by rattengift »

> alle dateien zu druchsuchen, in denen "*glib" vorkommt

ach so, er meinte "...in deren DATEINAMEN....". sorry, hab nicht genau gelesen. ich hatte es wörtlich genommen. grrrr, dass die leute ihre fragen aber auch nicht klarer formulieren können....

Post Reply