I need help with writing a shell program that finds the phrase Candy Land and prints out the 10 lines surrounding the line where that word is found. Assume it is only found once.I don't know what it means by shell program and by printing the 10 lines surrounding that word. Maybe using head/tail.I know using grep you can find the phrase by doing this:grep 'Candy Land' fileBut I don't think this is what I'm suppose to do.
Write a program that finds a phrase and print out
shell;grep
Grep has couple of flags such as -A for displaying the number line after the match and -B for displaying the number lines before the match both expects a number followed by the flag.And the flag -C can also be used which combines both to give you one line both before and after.For example,grep -A 1 -B 1 'Candy Land' fileorgrep -C 1 'Candy Land' file