-n, --line-number
Print the line number with output lines.
An option of grepx.
Usage
grepx -n PATTERNS [FILE]...
grepx --line-number PATTERNS [FILE]...Details
| Short | Long | Value | Default | Meaning |
|---|---|---|---|---|
-n | --line-number | none | print the line number with output lines |
Examples
Search a source tree for a whole word, with file names and line numbers
grepx -rnw 'TODO' srcsrc/main.go:42: // TODO: handle the empty caseSearch a tree but skip the dependency and VCS directories
grepx -rn --exclude-dir=node_modules --exclude-dir=.git 'fetch(' .Stop after the first three matches and number them
grepx -n -m 3 'panic' crash.logSearch in the portable gnux shell, the same on every platform
gnux shell -c 'catx notes.txt | grepx -n urgent'Help in the terminal
gnux help grepx --line-number