App-PTP
view release on metacpan or search on metacpan
lib/App/PTP/Cheat_Sheet.pod view on Meta::CPAN
=pod
=head1 PTP Cheat Sheet
=head2 SYNOPSIS
Install with:
sudo apt-get install perl cpanminus perl-doc build-essential
# or
sudo yum install perl Perl-App-cpanminus perl-doc gcc make
sudo cpanm App::PTP -n -L /usr/local --man-pages --install-args \
'DESTINSTALLBIN=/usr/local/bin'
Run with:
ptp file1 file2 ... [--grep re] [--substitute re subst] ... [-o out]
=head2 INPUT FILES
Input files can appear anywhere on the command line and are processed in the
order in which they are given.
=over 8
=item C<F<filename>> (anywhere in the command line, not starting with a C<->)
=item C<-> (reads from stdin)
=item C<-- F<filename> ...> (for any filename)
=back
=head2 PIPELINE COMMANDS
Pipeline commands are applied, in order, to all the input files.
=over 8
=item B<--g> I<regex> (B<--grep>), B<-s> I<regex> I<string> (B<--substitute>)
=item B<--p> I<code> (B<-perl>): read and write C<$_> to modify the file
=item B<-n> I<code>: read from C<$_>, write the return values
=item B<-f> I<code> (B<--filter>): return I<true> to keep the line
=item B<-e> I<code> (B<--execute>): execute once per input file
=item B<-l> I<path> (B<--load>): execute the given file, once per input file
=item B<-M> I<module>: load the given module
=item B<--sort>, B<--ns> (B<--numeric-sort>), B<--ls> (B<--locale-sort>),
B<--ss> (B<--semver-sort>), B<--cs> I<code> (B<--custom-sort>)
=item B<-u> (B<--unique>), B<--gu> (B<--global-unique>)
=item B<--head> [I<n>], B<--tail> [I<n>], B<--reverse> (B<--tac>), B<--shuffle>
=item B<--eat>: discard the content of the file
=item B<--ml> I<code> (B<--mark-line>): set the marker for the line with the
return value
=item B<--clear-markers>, B<--set-all-markers>
=item B<--delete-marked>, B<--delete-before>, B<--delete-after>,
B<--delete-at-offset> I<offset>
=item B<--insert-before> I<string>, B<--insert-after> I<string>,
B<--insert-at-offset> I<offset> I<string>: insert interpolated text next to marked
lines (offset I<0> is just after)
=item B<--cut> I<N>,I<N>,...: select fields according to B<-F> and concatenate
them with B<-P>
=item B<--paste> I<file>: paste with B<-P> line by line with the current content
=item B<--pivot>: turn the file into a single line with B<-P>
=item B<--anti-pivot>: split all lines according to B<-F>
=item B<--transpose>: transpose lines and columns using B<-F> and B<-P>
=item B<--nl> (B<--number-lines>), B<--pfn> (B<--prefix-file-name>)
=item B<--fn> (B<--file-name>), B<--lc>, B<--line-count>: replace the content of
the file
=item B<-m> (B<--merge>): merge all the files in a single one
=item B<--tee> I<filename>: duplicate the output
=item B<--shell> I<command>: sends the content as input to the command
=item B<--xargs> I<command>: execute the command (which can contain C<{}>) for each line.
=item B<--push>, B<--pop>: push and pop the entire content of the current file.
=back
=head2 PROGRAM BEHAVIOR
Global option for the program execution.
=over 8
=item B<-o> I<output_file> (B<--output>), B<-a> I<output_file> (B<--append>),
B<-i> (B<--in-place>): by default output to standard output
=item B<-R>, B<--recursive>, B<--input-filter> I<code>: expand directories,
optionally filter input files
( run in 0.612 second using v1.01-cache-2.11-cpan-5735350b133 )