steve007
Goto Top

Dateiinhalt suchen mit grep!

Grep Suche

Hallo,

ich würde gerne in einen Verzeichnis wo viele Dateien drin sind einen Text suchen den ich vorgebe und er soll mir die Dateien ausgeben wo der Text enthalten ist.

grep -i "MeineTextSuche" *

wenn ich dann bestätige kommt:

Argument list too long

was ist denn da falsch?

Ciao
Steve007

Content-Key: 79001

Url: https://administrator.de/contentid/79001

Printed on: April 19, 2024 at 03:04 o'clock

Mitglied: 39916
39916 Jan 24, 2008 at 09:35:35 (UTC)
Goto Top
Argument list too long

When using grep or other commands that requires a listing or search through several thousand files you may get the "Argument list too long" or "/bin/grep: Argument list too long." error. When this occurs you may want to use a command similar to the below, using the find command and xargs command in conjunction with the grep.

find Members/ -type f -print0 | xargs -0 grep "examplestring"

In the above example the find command finds all files in the Members directory each file that is found is then searched using grep for the text "examplestring". This above example had no problems searching over 100 thousand files.


Quelle: http://www.computerhope.com/unix/ugrep.htm

Gruß,

Martin
Member: steve007
steve007 Jan 27, 2008 at 10:45:53 (UTC)
Goto Top
Hallo,

da habe ich jetzt ein Verzeichnis angegeben und hat funktioniert das er die Datei ausgegeben hat wo der String vorkommt.
Aber nur die letzte Datei mit dem ältesten Datum, aber es existieren ja in diesen Verzeichnis min. 100 von den Dateien die diesen String enthalten.
Was kann das denn sein?

MfG.
steve007