GREP(1plan9)
β¨ NAME β¨
okay bestie, welcome to the plan9 manual page GREP(1plan9) π
grep, g β search a file for a pattern. That's the whole vibe.
π SYNOPSIS π
grep [ option ... ] pattern [ file ... ]
g [ option ... ] pattern [ file ... ]
Two moods, same energy. Slay.
π DESCRIPTION π
Grep searches the input files (standard input is the default, no cap) for lines that match the pattern. The pattern is a regular expression as defined in regexp(7), but with a little plot twist: a newline character is an alternative (substitute for |) with lowest precedence. Normally, each line matching the pattern is selected, and each selected line is copied to the standard output. Iconic.
The options are:
-cβ Print only a count of matching lines. Just the number, periodt.-hβ Do not print file name tags (headers) with output lines. No header energy.-eβ The following argument is taken as a pattern. This option makes it easy to specify patterns that might confuse argument parsing, such as-n. So helpful.-iβ Ignore alphabetic case distinctions. The implementation folds into lower case all letters in the pattern and input before interpretation. Matched lines are printed in their original form. It's giving lowercase era, but the receipts stay original.-lβ (ell) Print the names of files with selected lines; don't print the lines. Just the file names, bestie.-Lβ Print the names of files with no selected lines; the converse of-l. Opposite day.-nβ Mark each printed line with its line number counted in its file. Line numbers for the girls.-sβ Produce no output, but return status. Silent but deadly.-vβ Reverse: print lines that do not match the pattern. Not like other greps.-fβ The pattern argument is the name of a file containing regular expressions one per line. Pattern file realness.-bβ Don't buffer the output: write each output line as soon as it is discovered. Immediate, no waiting.
Output lines are tagged by file name when there is more than one input file. (To force this tagging, include /dev/null as a file name argument.) So if you want tags on purpose, you know what to do.
Care should be taken when using the shell metacharacters$*[^|()=\and newline in pattern; it is safest to enclose the entire expression in single quotes'...'. An expression starting with*will treat the rest of the expression as literal characters. Protect your peace and your patterns.
And G invokes grep with -n and forces tagging of output lines by file name. If no files are listed, it searches all files matching
*.C *.b *.c *.h *.m *.cc *.java *.cgi *.pl *.py *.tex *.ms
π SOURCE π
/src/cmd/grep/bin/g
π SEE ALSO π
π¨ DIAGNOSTICS π¨
Exit status is null if any lines are selected, or non-null when no lines are selected or an error occurs. So null = we found something, non-null = no matches or oops.
that's the tea, bestie β from the plan9 manual, GREP(1plan9) ππβ¨
π¦ where this page comes from
- debian bookworm: 9base 1:6-13 Β· Lucent
- debian trixie: 9base 1:6-14 Β· Lucent
- ubuntu jammy: 9base 1:6-11 Β· Lucent
- ubuntu noble: 9base 1:6-14 Β· Lucent
- ubuntu questing: 9base 1:6-15
- ubuntu resolute: 9base 1:6-15build1 Β· Lucent
- ubuntu stonking: 9base 1:6-15build1 Β· Lucent
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms