shisha
Goto Top

Unix Befehl Grep - find

Hallo liebe Gemeinde,

ich weiß das es einen Befehl bestehend aus Grep und Find gibt mit dem man Dateien in einem Verzeichnis nach einem Wort durchsuchen kann, nur leider hab ich die richtige Syntax vergessen.
Ich hatte jetzt schon einige Befehle probiert nur leider sucht er entweder gar nicht oder er durchsucht alle Dateien auf dem Server - das dauert dann bestimmt Stunden (hab ich dann abgebrochen).

Also mein Problem kurz erklärt:

im Verzeichnis: /Beispiel/Test möchte ich alle darin enthalten Dateien nach einem Wort durchsuchen und als Ausgabe dann jene Dateien angezeigt bekommen in denen dieses Wort vorkommt.

Habt ihr da eine Idee dazu?

Danke

Content-Key: 255695

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

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

Member: Gersen
Gersen Nov 24, 2014 updated at 11:11:18 (UTC)
Goto Top
Hallo,

versuch doch mal
grep -r DeinWort /Beispiel/Test
Brauchst Du nur den Dateinamen, wäre es
grep -rl DeinWort /Beispiel/Test

Gruß,
Gersen
Member: Lochkartenstanzer
Lochkartenstanzer Nov 24, 2014 updated at 11:58:43 (UTC)
Goto Top
Moin,

man grep
liefert Dir unter anderem
GREP(1)                                              General Commands Manual                                             GREP(1)



NAME
       grep, egrep, fgrep, rgrep - print lines matching a pattern

SYNOPSIS
       grep [OPTIONS] PATTERN [FILE...]
       grep [OPTIONS] [-e PATTERN | -f FILE] [FILE...]

...

OPTIONS
   Generic Program Information
       --help Print a usage message briefly summarizing these command-line options and the bug-reporting address, then exit.

...

       -L, --files-without-match
              Suppress normal output; instead print the name of each input file from which no output would  normally  have  been
              printed.  The scanning will stop on the first match.

       -l, --files-with-matches
              Suppress  normal  output;  instead  print  the  name of each input file from which output would normally have been
              printed.  The scanning will stop on the first match.  (-l is specified by POSIX.)

 ..


User Commands                                             GNU grep 2.16                                                  GREP(1)



lks