Most of the time, we issue the following to find needle in the haystack:
grep needle file.txt
This prints out the matching pattern. If the output is way too long and we only need a section of it, we can use the extended grep (a.k.a. egrep) option.
Here's how to use regular expressions to instruct grep to only display 40 characters before and after the matching pattern:
grep -Eo '.{0,40}needle.{0,40}' file.txt
ReplyDeletegreat article which conveyed a good information.awaiting for more updaates like this.
SEO Company in India
SEO Services in India
SEO Companies in India
SEO Company India
SEO Services India
This comment has been removed by the author.
ReplyDeleteI am very impressed with your post because this post is very beneficial for me and provide a new knowledge to me
ReplyDeletebu jhansi ba 2nd year result 2022