I have file containing lines in following format:
2021-Jan-26 05:35 foo bar 2
2021-Jan-26 05:37 asdf 2 foo bar
2021-Jan-26 05:37 foo
The patterns that I am interested start at position 20. So when I grep the file for specific pattern, I want to skip (not match) first 19 characters.
So, I want to match a pattern anywhere on the line, except first 19 characters
In the example above, if I grep for 2
, I only want to match lines 1 and 2.
How can I do this with grep
?
grep '^.\{19\}.*2'
orgrep -E '^.{19}.*2'
. – Quasímodo Jan 26 '21 at 11:41