[-f FILE, --file=FILE]
الگوها را از فابل بخواند. هر الگو در یک خط نوشته شود
The empty file contains zero patterns, and therefore matches nothing.
[-i, --ignore-case, -y]
عدم حساسیت به حروف بزرگ و کوچک
Ignore case distinctions in both the PATTERN and the input files.
y سوییچ قدیمی هست و i جدیدتری است
[-v, --invert-match]
الگوی مورد نظر را نشان ندهد
[-x, --line-regexp]Select only those lines containing matches that form whole words.$ grep -w ping #does not match ping”
درصورتی چیزی پیدا کن که (دقیقا) تمام یک خط دقیق الگوی وارد شده باشد
$ grep "hello I am behrooz" sample3:hello I am behrooz sample3:hello I am behrooz! and what is this sample3:hello I am behrooz!, I am fine $ grep -x "hello I am behrooz" sample3:hello I am behrooz
Count the Number of Matches$ grep -c salam *.txt sample1.txt:7 sample2.txt:1 sample3.txt:31 sample4.txt:22
export GREP_COLOR='1;32' #setting green color for pattern
cat file.txt |grep PATTERN --color=auto
فایلهایی که الگو را دارا نمیباشند$ grep -L "how" *.txt #find all files (in the current directory) that do not contain the word "how" file1.txt file25.txt file67.txt
تنها نام فایلهایی که الگو در آن یافت شده است را نشان خواهد داد$ grep -l "how" *.txt #find all files (in the current directory) that do not contain the word "how"
file1.txt
file25.txt
file67.txt
Stop reading a file after NUM matching lines. If the input is standard input from a regular file, and NUM matching lines are output, grep ensures that the standard input is positioned to just after the last matching line before exiting, regardless
This enables a calling process to resume a search. When grep stops after NUM matching lines, it outputs any trailing context lines. When the -c or --count option is also used, grep does not output a
When the -v or --invert-match option is also used, grep stops after outputting NUM non-matching lines.
Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.
Quiet; do not write anything to standard output. Exit immediately with zero status if any match is found, even if an error was detected. Also see the -s or --no-messages option.
درباره این سایت