grep - Regex for Negative Lookahead -
i need regex match using egrep
checks pattern following 1_0_5
in long request string. if consider pattern a_b_c
. want b apart 2, 3, 4 , 13.
this should it:
grep -p '\b[^_]+_(?!(2|3|4|13)_)[^_]+_[^_]+\b' myfile
if terms digits, refine this:
grep -p '\b\d+_(?!(2|3|4|13)_)\d+_\d+\b' myfile
note -p
flag turn on perl comparability, allows aheads
Comments
Post a Comment