Skip to content

Instantly share code, notes, and snippets.

@b-layer
b-layer / breakdown.awk
Created March 19, 2021 10:31
An awk script I threw together to break down strings for explanation in Stack Exchange answers.
# 1. Take any string such as this regex \v<[1-9]\d{,2}\ze(\d{3})*>
# 2. Indicate separations with a delimiter char like underscore
# 3. Run awk like so:
#
# awk -v RS='_' -f {thisfile} <<< '\v_<_[1-9]_\d_{,2}_\ze_(_\d_{3}_)_*_>'
# Result:
# \v<[1-9]\d{,2}\ze(\d{3})*>
# \v #