g: expand matched files list and add to grep(1) man page
This commit is contained in:
parent
1e04852c3d
commit
b6993361e0
2 changed files with 25 additions and 2 deletions
2
rc/bin/g
2
rc/bin/g
|
@ -14,7 +14,7 @@ case 0
|
||||||
exit usage
|
exit usage
|
||||||
case 1
|
case 1
|
||||||
pattern=$1
|
pattern=$1
|
||||||
files=(`{ls *.[bcChm] *.cc *.py *.tex *.ms *.java >[2]/dev/null})
|
files=(`{ls *.[bcChlmy] *.asm *.cc *.cs *.lx *.cgi *.pl *.py *.tex *.ms *.java *.xy *.go *.goc >[2]/dev/null})
|
||||||
case *
|
case *
|
||||||
pattern=$1
|
pattern=$1
|
||||||
shift
|
shift
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.TH GREP 1
|
.TH GREP 1
|
||||||
.SH NAME
|
.SH NAME
|
||||||
grep \- search a file for a pattern
|
grep, g \- search a file for a pattern
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B grep
|
.B grep
|
||||||
[
|
[
|
||||||
|
@ -16,6 +16,15 @@ grep \- search a file for a pattern
|
||||||
[
|
[
|
||||||
.I file ...
|
.I file ...
|
||||||
]
|
]
|
||||||
|
.br
|
||||||
|
.B g
|
||||||
|
[
|
||||||
|
.B flags
|
||||||
|
]
|
||||||
|
.I pattern
|
||||||
|
[
|
||||||
|
.I file ...
|
||||||
|
]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.I Grep\^
|
.I Grep\^
|
||||||
searches the input
|
searches the input
|
||||||
|
@ -96,8 +105,22 @@ in single quotes
|
||||||
An expression starting with '*'
|
An expression starting with '*'
|
||||||
will treat the rest of the expression
|
will treat the rest of the expression
|
||||||
as literal characters.
|
as literal characters.
|
||||||
|
.PP
|
||||||
|
.I G\^
|
||||||
|
invokes
|
||||||
|
.I grep
|
||||||
|
with
|
||||||
|
.B -n
|
||||||
|
(plus aditional flags, if provided)
|
||||||
|
and forces tagging of output lines by file name. If no files
|
||||||
|
are listed, it searches all files matching
|
||||||
|
.B *.asm *.cc *.cs *.lx *.cgi *.pl
|
||||||
|
.B *.py *.tex *.ms *.java *.xy *.go
|
||||||
|
.B *.goc
|
||||||
.SH SOURCE
|
.SH SOURCE
|
||||||
.B /sys/src/cmd/grep
|
.B /sys/src/cmd/grep
|
||||||
|
.br
|
||||||
|
.B /rc/bin/g
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.IR ed (1),
|
.IR ed (1),
|
||||||
.IR awk (1),
|
.IR awk (1),
|
||||||
|
|
Loading…
Reference in a new issue