From 3a87634357407be554f32880d9a6600d2db55431 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 2 Feb 2025 17:12:13 -0500 Subject: bsgrep: add -F option. --- bsgrep | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bsgrep b/bsgrep index ed57824..26f247e 100755 --- a/bsgrep +++ b/bsgrep @@ -29,11 +29,11 @@ $SIG{__WARN__} = sub { }; sub grep_usage { - print "usage: $self [--help | --version | -[iklnrsvwqz] [-d char] ...] [ ...]\n"; + print "usage: $self [--help | --version | -[Fhiklnrsvwqz] [-d char] ...] [ ...]\n"; } sub grep_options { - getopts('d:hiklnqrsvwz', \%opt) || exit 1; + getopts('d:Fhiklnqrsvwz', \%opt) || exit 1; if($opt{h}) { grep_usage(); exit(0); @@ -96,6 +96,7 @@ if($self =~ /join/) { grep_usage(); die("$self: missing required regex argument\n"); } + $regex = quotemeta($regex) if $opt{F}; $regex = "(?i)$regex" if $opt{i}; } @@ -255,6 +256,10 @@ These options are only supported by B: =over 4 +=item -F + +Treat pattern(s) as fixed strings, not regular expression(s). Same as B. + =item -i Case-insensitive search (same as B). @@ -355,6 +360,9 @@ B's exit status. =head1 LIMITATIONS +B doesn't detect binary files like B does. It can and +will print them to your terminal instead of "binary file matches". + Not all b options are supported. Options that aren't implemented but might be someday include B<--color>, B<-a>, B<-A>, B<-B>, B<-C>, B<-o>. I don't intend to implement every single option B has, there are -- cgit v1.2.3