[-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
توقف بعد از اینکه تعداد مشخص شده پیدا شده باشد
Quiet; do not write anything to standard outputExit immediately with zero status if any match is found, even if an error was detected.
درباره این سایت