Search plugin: Or browse by category:

awk-select-lines summary

Plugin Name: awk-select-lines
Version: 0.0.4
Author: @melezhik
Realease Date: 2017-09-11 14:00:35
Short Description: Select lines between two patterns using awk
Category: awk
Plugin web page: https://github.com/melezhik/awk-select-lines
Download link: awk-select-lines-v0.000004.tar.gz
Latest version link: https://sparrowhub.org/info/awk-select-lines

awk-select-lines documentation

awk-select-lines doc

SYNOPSIS

Select lines between two patterns using awk.

The author of original awk script is fedorqui the code is taken from StackOverflow.

INSTALL

$ sparrow plg install awk-select-lines

USAGE

To print lines between two patterns ($pat1 and $pat1) in $file:

$ sparrow plg run awk-select-lines \
--format concise  # to strip reports lines 
--param file=/path/to/file/example.txt \
--param pat1=PAT1 --param pat2=PAT2 \
--param mode=2

Setting mode:

Mode parameter define the selection logic, based on explanation taken from

https://stackoverflow.com/a/38972737/5147708

  • mode=1 (default mode) - Print lines between PAT1 and PAT2
  • mode=2 - Print lines between PAT1 and PAT2 - not including PAT1 and PAT2
  • mode=3 - Print lines between PAT1 and PAT2 - including PAT1
  • mode=4 - Print lines between PAT1 and PAT2 - including PAT2
  • mode=5 - Print lines between PAT1 and PAT2 - excluding lines from the last PAT1 to the end of file if no other PAT2 occurs

Plugin maintainer

Alexey Melezhik

Prerequisites

Awk should be installed