Sunday, July 5, 2020

Unix / Shell Script - Notes


* GREP - Print characters before and after a pattern match
    grep -oP '.{0,5}searchStr.{0,10}'

* GREP all characters after the match
   grep -oP 'searchStr.*'

GREP all characters before the match

   grep -oP '.*searchStr'

* Reverse/Inverse grep: grep -v  to get all non-matching lines

No comments:

Post a Comment