$ grep -A1 text
-AX tells grep to display 'X' amount of lines after line of match.
Use -BX to do the same but before.
Include -A flag to add lines after match and -B flag to add lines before
grep match -A 3 #display match line and 3 after lines
grep match -B 2 #display match line and 2 lines before
sed -n -e '/Word A/,/Word D/ p' file
# display 3 lines before and after matchline
rg -C 3 "keyword"