Linux rgrep-Befehl
Linux Command大全
Der rgrep-Befehl von Linux wird verwendet, um rekursiv nach Strings mit bestimmten Kriterien in Dateien zu suchen.
Die Funktion des rgrep-Befehls ist ähnlich wie die des grep-Befehls, er kann Dateien finden, die den angegebenen Musterstyle enthalten. Wenn eine Datei den angegebenen Musterstyle enthält, zeigt der rgrep-Befehl standardmäßig die Spalte mit dem Musterstyle an.
Syntax
rgrep [-?BcDFhHilnNrv][-R<Musterstyle>][-W<Spaltenlänge>][-x<Erweiterung>][--help][--version][Musterstyle][Datei oder Verzeichnis...]
参说明数:
- -? Anzeigen der Erklärung der Musterstyle und Beispiele.
- -B Ignorieren von binären Daten.
- -c Berechnung der Anzahl der Spalten, die dem Muster entsprechen.
- -D Fehlermodus, nur die Verzeichnisse auflisten, in denen der Befehl gesucht wird, ohne den Inhalt der Dateien zu lesen.
- -F When encountering symbolic links, rgrep defaults to ignoring them and not processing them. Adding this parameter will make rgrep read the content of the original file pointed to by the link.
- -h Especially mark the strings that match the template style.
- -H Only list strings that match the template style, rather than displaying the entire column content.
- -i Ignore the difference in character case.
- -l List file names whose content matches the specified template style.
- -n Before displaying the column that matches the template style, indicate the column number of that column.
- -N Do not process recursively.
- -r Recursive processing, processing all files and subdirectories in the specified directory.
- -R<Template Style> The effect of this parameter is similar to that of specifying "-r parameters similar, but only focus on files with names that match the template style.
- -v Invert search.
- -W<column length> Limit the number of characters that must be owned by the string that matches the template style in the column.
- -x<extension> Only process files with the specified extension names.
- --help Online help.
- --version Display version information.
Online Examples
To find files in the current directory that contain the string 'Hello', you can use the following command:
rgrep Hello *
The search results are as follows:
$ rgrep Hello * #Find files in the current directory that contain the string 'Hello'
testfile_1:Hello 95 #testfile_1Sentences containing the string 'Hello'
testfile_2:Hello 2005 #testfile_2Sentences containing the string 'Hello'
Linux Command大全