Пример файла данных:
test
name = any_name
status = Wait
some data
Поиск name
и строки grep after (grep и awk)
grep -A 1 "name" file
awk '/name/ {p=2} p--' file
name = any_name
status = Wait
Поиск status
и строки grep before (grepи awk)
grep -B 1 "status" file
awk '/status/ {print s"\n"$0} {s=$0}' file
name = any_name
status = Wait