This commit is contained in:
Ole Tange 2017-01-31 23:53:13 +01:00
parent c4ebb7aae2
commit 9e9b965424
3 changed files with 82 additions and 3 deletions

75
G/G Executable file
View file

@ -0,0 +1,75 @@
#!/usr/bin/perl
=pod
=head1 NAME
G - short hand for multi level greps
=head1 SYNOPSIS
B<G> [[grep options] string] [[grep options] string] ...
=head1 DESCRIPTION
B<G> is a short hand of writing:
grep --option string | grep --option2 string2
=head1 EXAMPLE
Grep for lines with Foo but not Bar:
G Foo -v Bar
=head1 AUTHOR
Copyright (C) 2017 Ole Tange,
http://ole.tange.dk and Free Software Foundation, Inc.
=head1 LICENSE
Copyright (C) 2012 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
at your option any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
=head1 DEPENDENCIES
B<G> uses B<grep>.
=head1 SEE ALSO
B<openssl>
=cut
my $i = 0;
while(@ARGV) {
$_ = shift;
push @{$cmd[$i]}, $_;
if(/^[^-]/) {
$i++
}
}
exec join"|", map { "grep @$_" } @cmd;

View file

@ -1,12 +1,12 @@
CMD = blink bsearch histogram upsidedown tracefile timestamp rand rrm goodpasswd gitnext puniq ramusage ramusage CMD = blink bsearch G histogram upsidedown tracefile timestamp rand rrm goodpasswd gitnext puniq ramusage ramusage
all: blink/blink.1 bsearch/bsearch.1 goodpasswd/goodpasswd.1 histogram/histogram.1 puniq/puniq.1 rand/rand.1 rrm/rrm.1 timestamp/timestamp.1 tracefile/tracefile.1 upsidedown/upsidedown.1 wssh/wssh.1 all: blink/blink.1 bsearch/bsearch.1 G/G.1 goodpasswd/goodpasswd.1 histogram/histogram.1 puniq/puniq.1 rand/rand.1 rrm/rrm.1 timestamp/timestamp.1 tracefile/tracefile.1 upsidedown/upsidedown.1 wssh/wssh.1
%.1: % %.1: %
pod2man $< > $@ pod2man $< > $@
install: install:
mkdir -p /usr/local/bin mkdir -p /usr/local/bin
parallel -v eval ln -sf `pwd`/*/{} /usr/local/bin/{} ::: $(CMD) parallel eval ln -sf `pwd`/*/{} /usr/local/bin/{} ::: $(CMD)
mkdir -p /usr/local/share/man/man1 mkdir -p /usr/local/share/man/man1
parallel ln -sf `pwd`/{} /usr/local/share/man/man1/{/} ::: */*.1 parallel ln -sf `pwd`/{} /usr/local/share/man/man1/{/} ::: */*.1

4
README
View file

@ -10,10 +10,14 @@ field - Split on space. Give the given field number. Supports syntax 1-3,6-
forever - Run the same command or list of commands every second. forever - Run the same command or list of commands every second.
G - short hand for multi level grep.
gitnext - Checkout next revision. Opposite of 'checkout HEAD^'. gitnext - Checkout next revision. Opposite of 'checkout HEAD^'.
neno - No error no output. Only print STDERR and STDOUT if the command fails. neno - No error no output. Only print STDERR and STDOUT if the command fails.
puniq - Print unique lines the first time they are seen.
rand - Generate (pseudo-)random data rand - Generate (pseudo-)random data
rclean - Remove files with MD5 sums recorded by rrm (see below). rclean - Remove files with MD5 sums recorded by rrm (see below).