Co robi GREP użycie. Konsola are described in Chapter 7 . Exit status is 0 if any lines match, 1 if.

Czy przydatne?

Polecenie grep

Wykonanie, użycie: Search one or more files for lines that match a regular expression pattern. Regular expressions are described in Chapter 7. Exit status is 0 if any lines match, 1 if none match, and 2 for errors. See also egrep and fgrep

Opcje wykonania grep w konsoli

-a, --text

Don't suppress output lines with binary data; treat as text.

-b, --byte-offset

Print the byte offset within the input file before each line of output.

-c, --count

Print only a count of matched lines. With -v or --revert-match option, count nonmatching lines.

-d action, --directories=action

Define an action for processing directories. Possible actions are:


Read directories like ordinary files (default).


Skip directories.


Recursively read all files under each directory. Same as -r.

-e pattern, --regexp=pattern

Search for pattern. Same as specifying a pattern as an argument, but useful in protecting patterns beginning with -.

-f file, --file=file

Take a list of patterns from file, one per line.

-h, --no-filename

Print matched lines but not filenames (inverse of -l).

-i, --ignore-case

Ignore uppercase and lowercase distinctions.

-l, --files-with-matches

List the names of files with matches but not individual matched lines; scanning per file stops on the first match.


Try to use memory mapping (mmap) to read input in order to save time.

-n, --line-number

Print lines and their line numbers.

-q, --quiet, --silent

Suppress normal output in favor of quiet mode; scanning stops on the first match.

-r, --recursive

Recursively read all files under each directory. Same as -d recurse.

-s, --no-messages

Suppress error messages about nonexistent or unreadable files.

-v, --invert-match

Print all lines that don't match pattern.

-w, --word-regexp

Match on whole words only. Words are divided by characters that are not letters, digits, or underscores.

-x, --line-regexp

Print lines only if pattern matches the entire line.

-A num, --after-context=num

Print num lines of text that occur after the matching line.

-B num, --before-context=num

Print num lines of text that occur before the matching line.

-C[num] , --context[=num] , -num

Print num lines of leading and trailing context. Default context is 2 lines.

-E, -extended-regexp

Act like egrep, recognizing extended regular expressions such as (UN|POS)IX to find UNIX and POSIX.

-F, --fixed-strings

Act like fgrep, recognizing only fixed strings instead of regular expressions. Useful when searching for characters that grep normally recognizes as metacharacters.

-G, --basic-regexp

Expect the regular expressions traditionally recognized by grep (the default).

-H, --with-filename

Display, before each line found, the name of the file containing the line. This is done by default if multiple files are submitted to a single grep command.

-V, --version

Print the version number and then exit.

-Z, --null

When displaying filenames, follow each with a zero byte instead of a colon.

Przykłady grep działanie w Słownik polecenie G

Przykład GREP użycie :
Jak użyć Guard application allows you to encrypt and decrypt information, create public and private encryption keys, and use or verify digital signatures. GPG is based on the use of a pair of keys, one public co znaczy.
Przykład GREP użycie :
Jak użyć Show the groups that each user belongs to (default user is the owner of the current group). Groups are listed in /etc/passwd and /etc/group krzyżówka.
Przykład GREP użycie :
Jak użyć The GNU version of awk , a program that does pattern matching, record processing, and other forms of text manipulation. For more information, see Chapter 1 co to jest.
Przykład GREP użycie :
Jak użyć Uncompress files compressed by gzip . See gzip for a list of options słownik.
Przykład GREP użycie :
Jak użyć Print the kernel's scancode-to-keycode mapping table czym jest.