I am trying to grep for 5 lines before and after a match. Since I am using AIX I do not have the GNU feature of :
grep -B 5 -A 5 pattern file
Is there a way to do this with grep, awk, perl, sed, something else? Can I please get a one liner? I am trying to do this across multiple servers.
Adding more information:
$ cat b.txt
100
101
102
103
104
Successful
105
106
107
108
109
110
111
112
113
114
115
116
Successful
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
Successful
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
Successful
154
155
156
157
$ grep -B 5 -A 5 Successful b.txt
100
101
102
103
104
Successful
105
106
107
108
109
--
112
113
114
115
116
Successful
117
118
119
120
121
--
129
130
131
132
133
Successful
134
135
136
137
138
--
149
150
151
152
153
Successful
154
155
156
157
$