How to Use Text Filters with Python, PHP and awk
Posted: Tue May 28, 2024 2:46 pm
Text filters can be written in scripting languages such as Python, PHP and awk. Selected text can be filtered through them to perform edits which TextPad cannot do natively. Any script or program which reads from stdin and writes to stdout can be employed. Anything written to stderr will appear in the Tool Output window.
The following screenshots show how to add a text filter written in PHP and then run it on a selected column of numbers to calculate their total.
The following screenshots show how to add a text filter written in PHP and then run it on a selected column of numbers to calculate their total.
- Add a filter:
- Select a scripting language:
- Give it a meaningful name:
- Apply it:
- Specify the script in the Parameters box then click OK:
- This the sample script in PHP: (it's in TextPad's Samples folder.)
- Select the column in block mode and run the script:
- The result: