This release is a pre-release and may not be stable for production use.
awkupy and IAwk
AWK meets Python: API, CLI and magics
A simple subprocess based Pythonic interface for Awk, which powers a command-line REPL and Jupyter magics.
Installation
pip install awkupy
Features
- Python class to call AWK via subprocess - see an example.
- IPython / Jupyter magics:
%awkand%%awk, enabling polyglot programming with Awk. See example and the tutorial for more details.
In [1]: %load_ext iawk
In [2]: cd doc/examples/
/home/avmo/src/projects/awkupy/doc/examples
In [3]: %%awk --stdout coins.txt
...: {
...: country[$4]++
...: }
...:
...: END {
...: for (i in country) print "Country: " i," count: ", country[i]
...: }
...:
...:
Country: USA count: 7
Country: PRC count: 1
Country: Austria-Hungary count: 1
Country: Canada count: 1
Country: Switzerland count: 1
Country: RSA count: 2
- IAwk: interactive AWK prompt modelled after IPython.
❯❯❯ iawk (awkupy)
Welcome to the IAwk shell. Type help or ? to list commands.
Prefix ! to run system commands
iawk [1]: help
Documented commands (type help <topic>):
========================================
EOF cd exit help hist history input ls reset run set shell show
iawk [2]: cd doc/examples/
doc/examples/
iawk [3]: ls
coins.txt coins_histogram.py coins_histogram.awk
iawk [4]: set pattern /gold/
iawk [5]: set action print $0
iawk [6]: input coins.txt
iawk [7]: show
#!/usr/bin/awk -f
/gold/ {print $0}
iawk [8]: run
iawk [9]: gold 1 1986 USA American Eagle
gold 1 1908 Austria-Hungary Franz Josef 100 Korona
gold 1 1984 Switzerland ingot
gold 1 1979 RSA Krugerrand
gold 0.5 1981 RSA Krugerrand
gold 0.1 1986 PRC Panda
gold 0.25 1986 USA Liberty 5-dollar piece
gold 0.25 1987 USA Constitution 5-dollar piece
gold 1 1988 Canada Maple Leaf
iawk [9]: exit
References
- To awk or not to ... - excellent tutorial on Awk
Metadata
Release files for awkupy 0.1.0b0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| awkupy-0.1.0b0.tar.gz | 19.8 kB | Without provenance | Details for awkupy-0.1.0b0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| awkupy-0.1.0b0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for awkupy-0.1.0b0-py2.py3-none-any.whl |
Total release size: 40.1 kB
Release files / awkupy-0.1.0b0.tar.gz
| Download URL | awkupy-0.1.0b0.tar.gz |
|---|---|
| Size | 19.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9cf17463c22d043fc096fa1f9fcaa59bc766422a19dfb46027a4b6a0d646193e
|
|
BLAKE2b-256 checksum How to use checksums |
f7516c6a643e23d42a9776abcb1901069d4851713c145edefad5590c97433c11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.1
|
Release files / awkupy-0.1.0b0-py2.py3-none-any.whl
| Download URL | awkupy-0.1.0b0-py2.py3-none-any.whl |
|---|---|
| Size | 20.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
63404f5969c6169f69ddfa8f195d7de845567e2f4a2404d64829fc03f4c227ff
|
|
BLAKE2b-256 checksum How to use checksums |
6eed5cb5b825d6f99ec5cbd69c9d92a9b60ecd5f05205be70752c7675db1eda6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.1
|
Security for awkupy 0.1.0b0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.