I have a text file say input.txt which contains below data
$ cat input.txt text1 error text2 text3 text4 xyz asd asdf text10 error text11 text12 text13 text14 def ghi jkl text16 error text17 text18 text19 text20 I'm searching for 'error' in input file. So I need to print the previous one line and next 4 lines when pattern matches. Also, the patter can occur in multiple times.
I need output as below
text1 error text2 text3 text4 text10 error text11 text12 text13 text14 text16 error text17 text18 text19 text20 Operating system is Solaris, So grep -A doesn't work here
grepat/usr/gnu/bin/grep?