Get stdout line substring based on regexp.
Project description
getsubstr
Utility that allows you get stdout line substring based on regexp.
usage: getsub [-h] [-l CUT_LEFT] [-r CUT_RIGHT] [--lwrap L_WRAP]
[--rwrap R_WRAP] [-s] [-j JOIN_RESULTS]
[--join-matches JOIN_MATCHES] [-i]
regexp_pattern
Get stdout line substring based on regexp.
positional arguments:
regexp_pattern Regexp pattern
optional arguments:
-h, --help show this help message and exit
-l CUT_LEFT, --left-cut CUT_LEFT
Cut N chars from left side of result
-r CUT_RIGHT, --right-cut CUT_RIGHT
Cut N chars from right side of result
--lwrap L_WRAP Wrap results from left side by specified char(s)
--rwrap R_WRAP Wrap results from left side by specified char(s)
-s, --strip Strip spaces from left and right side of result
-j JOIN_RESULTS, --join-results JOIN_RESULTS
Join all results with specified char(s)
--join-matches JOIN_MATCHES
Join more regexp matches with specified char(s).
Default is TAB \t
-i, --ignore-errors Ignore errors caused regexp.
example:
echo "**** Error while updating article content id=498 ****" | getsub "id\=\d+" -l 3 -j "," --lwrap "\"" --rwrap "\""
"498"
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
GetSubString-1.0.1.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for GetSubString-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7534bcba696aea0496e470a5e3e819efcd9a0681ab21f039b82a0a1bcc61cca |
|
MD5 | 97f388a4ef4c484190be2557be26ecea |
|
BLAKE2b-256 | 989b5032f8a28ef3e6df1b8257c0106147d56065fe7203c4a48546df17159732 |