git: 9front

Download patch

ref: 8e329c2f1dae762c0f26dbc2d98f9b47e2c0e643
parent: 6e5069dadeb25fafd2c758932276c3b5d9793cc1
author: stanley lieber <stanley.lieber@gmail.com>
date: Thu Jul 5 09:12:04 EDT 2012

g: expand matched files list and add to grep(1) man page

--- a/rc/bin/g
+++ b/rc/bin/g
@@ -14,7 +14,7 @@
          exit usage 
 case 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 * 
          pattern=$1 
          shift 
--- a/sys/man/1/grep
+++ b/sys/man/1/grep
@@ -1,6 +1,6 @@
 .TH GREP 1
 .SH NAME
-grep \- search a file for a pattern
+grep, g \- search a file for a pattern
 .SH SYNOPSIS
 .B grep
 [
@@ -16,6 +16,15 @@
 [
 .I file ...
 ]
+.br
+.B g
+[
+.B flags
+]
+.I pattern
+[
+.I file ...
+]
 .SH DESCRIPTION
 .I Grep\^
 searches the input
@@ -96,8 +105,22 @@
 An expression starting with '*'
 will treat the rest of the expression
 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
 .B /sys/src/cmd/grep
+.br
+.B /rc/bin/g
 .SH SEE ALSO
 .IR ed (1),
 .IR awk (1),
--