Using Python as awk alternative
Project description
awpie
Using Python as awk alternative.
Installation
$ pip install awpie
Usage
Upper case all inputs:
$ printf 'apple\norange\n' | awpie 'print(line.upper())'
APPLE
ORANGE
Change orange to banana:
$ printf 'apple\norange\n' | awpie 'print(line) if line != "orange" else print("banana")'
apple
banana
Local variables
Name | Description |
---|---|
line |
Current line. |
fields |
Result of line.split(sep) . sep can be specified in arguments. |
data |
An empty dict, can be used to store custom values. |
stdout |
sys.stdout . |
stderr |
sys.stderr . |
filename |
Name of the file currently being read. |
fileno |
File descriptor for the current file. |
lineno |
Cumulative line number of the line that has just been read. |
filelineno |
Line number in the current file. |
isfirstline |
Whether the line just read is the first line of its file or not. |
isstdin |
Whether the last line was read from sys.stdin or not. |
nextfile |
Close current file so that next iteration will be read from next file. |
close |
Close the sequence. |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
awpie-0.4.0.tar.gz
(2.9 kB
view hashes)
Built Distribution
awpie-0.4.0-py3-none-any.whl
(3.4 kB
view hashes)