App-pl
view release on metacpan or search on metacpan
pod/examples.pod view on Meta::CPAN
L<David Oswald|https://youtu.be/euj54cqpGOE>).
This is no attempt to appropriate ownership, just to show how things are even
easier and more concise with pl.
=head2 Dealing with Files
=over
=item Heads ...
I<People say the back of my head looks really nice -- but I don't see it. :-)>
If you want just I<n>, e.g. 10, lines from the head of each file, use the
optional number argument to B<-p>, along with B<-r> to reset the count. The
program can be empty, but must be present, unless you're reading from stdin:
pl -rp10 '' file*
If you want the head up to a regexp, use the flip-flop operator, starting with
line number 1. Use the print-if-true B<-P> loop option, again with B<-r> to
reset the count:
pod/examples.pod view on Meta::CPAN
> Configure
> -r-xr-xr-x 587687
> -r-xr-xr-x 587687
> -r-xr-xr-x 587825
> -r-xr-xr-x 587825
> ...
=item Diff ELF Executables by Loaded Dependencies
You get the idea: you can do this for any command that outputs records with a
unique key. This one looks at the required libraries and which file they came
from. For a change, loop with B<-O> and C<$A(RGV)> to avoid the previous
examples' confusion between outer C<$_> which were the cli args, and the inner
one, which were the read lines:
pl -O 'piped {
keydiff if s/^\t(.+\.so.*) => (.*) \(\w+\)/$2/;
} ldd => $ARGV' exe1 exe2 lib*.so
pl -O 'p {
k if s/^\t(.+\.so.*) => (.*) \(\w+\)/$2/;
} ldd => $A' exe1 exe2 lib*.so
( run in 0.835 second using v1.01-cache-2.11-cpan-64827b87656 )