I have a text file ( basically a log file) in linux and i have 2 words (alpha, beta).
Now i trying to to search these two words in one line and then print that line and next 15 lines in a temp file. there would be many lines with alpha and beta But I need only last occurrence with “alpha” and “beta” and next 15 lines.
I’ll be thankful if you also tell me command in case number of words increase, like 3 or 4 word to search on same line, alpha, beta, gamma
Your wording was a bit ambiguous, did you want a line with both alpha AND beta or alpha OR beta. If the first:
if the second: