PTP is a versatile and expressive text processor program. The core features that it tries to provide are the following:
Provide grep, sed-like and other operations with a coherent regular expressions language (grep has a -P flag but sed has nothing of the like).
Provide a powerful input/output files support, that is lacking when using vanilla-Perl one-liner (recursion in directories, output in-place with optional backups, etc.).
Pipelining of multiple operations on multiple files (using a pipeline made of several standard tool usually makes it difficult to process several input files at once).
See examples of PTP in action in the documentation.
You can find the documentation for the program itself on meta::cpan. After the program is installed, you can also get its documentation by running any of the following commands: man ptp, ptp --help or perldoc ptp.
The built-in --help rendering will be better if the perldoc program is installed. It usually comes in a perl-doc package on most systems.
Building and installing this program only requires Perl modules from the standard library. So as long as you have Perl installed (which should be the case by default on almost all system), you should be able to install ptp using one of the method below. This program requires Perl version 5.22 or above. You can check which Perl you have installed with the following command:
perl -v
To install the program manually from Git, you can run the following commands (you do need to have the make and git program installed):
git clone https://github.com/mkende/ptp.git
cd ptp
perl Makefile.PL
make
make test
sudo make install
This module is available on CPAN (the Perl package manager). The CPAN command should be installed on any system that has Perl (which, again, should mostly be any system at all). So, to install ptp automatically using CPAN, you can just run the following command:
cpan App::PTP
Note: if this is the first time that you run the cpan command, you will be asked to configure it. The default answer to most questions is usually fine.
The main development of this software is done on GitHub. However, it is also available on CPAN.
The following can be used only by the module maintainer on CPAN. To update the CPAN module, remember to increment the version number and then run the following commands:
perl Makefile.PL
make distcheck
# Optionally, to add files not in the manifest:
# make manifest
make dist
Finally, upload the App-PTP-version.tar.gz file that has been created through PAUSE, ideally putting it under an App-PTP directory.