Read a text/config file by sections
Project description
section
Mimics the behavior of Cisco IOS's | section ... command. Just like IOS, it supports parsing through a file and viewing sections of matched data. Like IOS, it supports _ as a blank, end-of-line, etc., (see here) for things like interfaces (for example, Gi1/1/1_ would not show Gi1/1/10, Gi1/1/11, etc). Requires Python 3.6 or higher.
Cisco IOS Example: show run brief | sec ^crypto (ipsec|isakmp)
Read a file and interpret it the same as: show command output | section
Examples:
python3 section.py "^interface Vlan10_" core9500.cfgcat core9500.cfg | python3 section.py "^interface Vlan10_"
Usage: section [options] "pattern to match" [filename]
positional arguments:
pattern-to-match pattern to match; quotes are required if pattern contains spaces; supports regex
filename file to read from; if not specified, read from STDIN
optional arguments:
-h, --help show this help message and exit
-i, --ignore-case ignore case distinctions
-m NUM, --max-count NUM
stop after NUM matches
-n, --line-number print line number with output lines
-b, --add-blank add a blank line between matched sections for readability
-v, --verbose show pattern that will be matched
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file section-explore-1.1.2.tar.gz.
File metadata
- Download URL: section-explore-1.1.2.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using 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.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0140b60e5d562df6f8981547a8fb2d24a9697ea648008dd14960fef88e559d52
|
|
| MD5 |
2c979f21cfe96f68a25c30915f9ebd5a
|
|
| BLAKE2b-256 |
453415655de5af55bb51e109bbdd4f29971b317d9709274058c676ecf1327585
|
File details
Details for the file section_explore-1.1.2-py3-none-any.whl.
File metadata
- Download URL: section_explore-1.1.2-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using 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.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc6cdc1b73fdcae053ff53b6158ece304dfe0ae78bc08ba9c4c7f895f021b242
|
|
| MD5 |
f7cb360b92033d799a4ad047297b9c68
|
|
| BLAKE2b-256 |
f512ae37c8858e4bba1390a2910826ff813e1c528b1ca06a87948c8d92a65673
|