/match-from-till

Awk script that outputs multi-line or single-line `--from` `--till` matches

Primary LanguageAwkGNU Affero General Public License v3.0AGPL-3.0

Match From Till

Awk script that outputs multi-line or single-line --from --till matches

Byte size of match-from-till Open Issues Open Pull Requests Latest commits


Table of Contents


Requirements

Awk or GAwk installed and executable under /usr/bin/awk file path.


Quick Start

Download the source code of this repository...

_downloads_path="${HOME}/git/hub/awk-utilities"

mkdir -vp "${_downloads_path}"
cd "${_downloads_path}"

git clone git@github.com:awk-utilities/match-from-till.git

Symbolically link to PATH accessible location...

_script_path="${_downloads_path}/match-from-till/match-from-till.awk"

ln -s ${_script_path} ${HOME}/bin/

Parse files with --from= --till= command line options and any number of files...

match-from-till.awk --from="start" --till="end" file-one.ext file-two.ext...

Notes

This script buffers lines between --from and --till matches; memory enough to handle the largest match is likely needed, and multi-file inputs may cause matching across document breaks


Lines are matched with ~ allowing for patterns to be passed with the --from and --till options...

match-from-till.awk --from="^start" --till="^end" <<EOF
start
middle
end

start middle end
EOF

This project is not feature complete but does function; Pull Requests and Issues are welcomed regarding what features need to be added.


Attribution


License

Legal bits of Open Source software

Match From Till documentation
Copyright (C) 2019  S0AndS0

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation; version 3 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.