aboutsummaryrefslogtreecommitdiff
path: root/bsgrep
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-02-02 17:12:13 -0500
committerB. Watson <urchlay@slackware.uk>2025-02-02 17:12:13 -0500
commit3a87634357407be554f32880d9a6600d2db55431 (patch)
tree9683d7423ff1e4f4f35160438a1aa8d43d6ac94f /bsgrep
parent34d1fb0b762d733216bb35868904cc72eddf3d6a (diff)
downloadmisc-scripts-3a87634357407be554f32880d9a6600d2db55431.tar.gz
bsgrep: add -F option.
Diffstat (limited to 'bsgrep')
-rwxr-xr-xbsgrep12
1 files 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] ...] <regex> [<file> ...]\n";
+ print "usage: $self [--help | --version | -[Fhiklnrsvwqz] [-d char] ...] <regex> [<file> ...]\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<bsgrep>:
=over 4
+=item -F
+
+Treat pattern(s) as fixed strings, not regular expression(s). Same as B<grep>.
+
=item -i
Case-insensitive search (same as B<grep>).
@@ -355,6 +360,9 @@ B<grep>'s exit status.
=head1 LIMITATIONS
+B<bsgrep> doesn't detect binary files like B<grep> does. It can and
+will print them to your terminal instead of "binary file matches".
+
Not all b<grep> 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<grep> has, there are