From http://stackoverflow.com/a/10489580
-
Match the first 18 chars from a given string
potatoon filefoo.txtegrep -Rso 'potato".{0,18}' foo.txt -
Match the previous 10 and next 10 chars:
egrep -Rso '.{0,10}potato".{0,10}' foo.txt
From http://stackoverflow.com/a/10489580
Match the first 18 chars from a given string potato on file foo.txt
egrep -Rso 'potato".{0,18}' foo.txt
Match the previous 10 and next 10 chars:
egrep -Rso '.{0,10}potato".{0,10}' foo.txt