common replace rule, new coloring library

This commit is contained in:
q
2016-06-04 20:41:08 +03:00
parent 4b57c0f416
commit c2deffa88f
3 changed files with 162 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ function helpexit() {
echo 'Modes:'
echo ' -n to match non-ascii and non-printable characters, and replace to [arg1]'
echo ' -f to replace match [arg1] with format [arg2], ex: -f "[0-9]\+" "%04d"'
echo ' -p to replace problematic characters [^\w()[]-.] with [arg1]'
exit
}
@@ -39,6 +40,10 @@ do [[ "${!i}" = "-h" ]] && helpexit
MODE=printf
continue
}
[[ "${!i}" = "-p" ]] && {
SRC='[^]\[0-9a-zA-Z_.()-]'
continue
}
[[ -z "$SRC" ]] && {
SRC="${!i}"
continue