Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
git='no';
ext='\.[ch]$';
FILES='.';
+lflag='';
kflag='no';
tflag='no';
t_enum='no';
grepc_parse_cmd()
{
- while getopts "ghkt:x:" opt; do
+ while getopts "lghkt:x:" opt; do
case "$opt" in
g)
git='yes';
k)
kflag='yes';
;;
+ l)
+ lflag='-l';
+ kflag='yes';
+ ;;
t)
case "$OPTARG" in
e)
xargs grep -lPI "$1" <"$files" \
| xargs grep -lP "$2" \
| sort \
- | xargs pcregrep -Mn "$3" /dev/null \
+ | xargs pcregrep $lflag -Mn "$3" /dev/null \
| if [ "$kflag" = 'no' ]; then
sed -E 's/^[^: ]+:[0-9]+:/\n\n&\n/';
else
grepc_parse_cmd $@;
grepc_find_files "$identifier";
grepc_search "$identifier" \
- | sed -n '/./,$p';
+ | if [ -n "$lflag" ]; then
+ sort \
+ | uniq;
+ else
+ sed -n '/./,$p';
+ fi;
}
Don't print extra newlines
(the header is printed in the same line as the first line of a match).
.TP
+.B \-l
+Suppress normal output;
+instead print the name of each input file
+from which output would normally have been printed.
+Each file is only printed once.
+.TP
.BI \-t " type"
Restrict the search to a specific
.I type