Befehl
Aufruf
$ grep --help
BusyBox v1.12.4 (2010-05-31 07:47:35 CEST) multi-call binary
Usage: grep [-HhrilLnqvsoeFEABC] PATTERN [FILEs...]
Search for PATTERN in each FILE or standard input
Options:
-H Prefix output lines with filename where match was found
-h Suppress the prefixing filename on output
-r Recurse subdirectories
-i Ignore case distinctions
-l List names of files that match
-L List names of files that do not match
-n Print line number with output lines
-q Quiet. Return 0 if PATTERN is found, 1 otherwise
-v Select non-matching lines
-s Suppress file open/read error messages
-c Only print count of matching lines
-o Show only the part of a line that matches PATTERN
-m MAX Match up to MAX times per file
-F PATTERN is a set of newline-separated strings
-E PATTERN is an extended regular expression
-e PTRN Pattern to match
-f FILE Read pattern from file
-A Print NUM lines of trailing context
-B Print NUM lines of leading context
-C Print NUM lines of output context
Beispiele
Läuft ein bestimmter Prozess? Das Suchen selbst taucht dabei auf.
# ps | grep snmpd
2779 root 3300 S ./snmpd
1631 root 1308 S grep snmp
Siehe auch