As the title suggests, I would like to search a file for multiple strings and for one particular string, show the 5 lines following it as well.cat file |grep -e 'string1' -e 'string2'works of course, but I would like to get something likecat file | grep -e 'string1' -e -A 5 'string2'How can I make it so that (I'm assuming using the -A 5 option) it shows only the lines containing string1 and only the lines containing string2 and the 5 lines after string2, but not the 5 lines after string1?EDIT: just got it working with awk:cat file |awk '/string1/{c=1}/string2/{c=5}{while(c-->0){print;getline}}'
Grep for multiple strings, show number of lines after one of the strings (but not the other)
shell script;text processing;grep