I want to grep the current date in a file, but also output the next 5 lines. How do i do that with the grep or anything else. grep -A 5 file.txt does not work and the output is shown below. Please help !$grep $(date +%m/%d) file.txt - this works only for the first line. But i want the next 5 lines displayed as well.$ grep -A 5 '$(date +%m/%d)' file.txtgrep: Not a recognized flag: AUsage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list...        [-f pattern_file...] [file...]Usage: grep [-r] [-R] [-H] [-L]  [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...]        -f pattern_file... [file...]Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] pattern_list [file...]
Want to grep a date in a file and its next 5 lines
grep;aix
Your grep doesn't support the -A flag, so you can't use that. But you should be able to get the same result with awk.awk -v dt=$(date +%m/%d) '$0~dt{counter=5}counter>=0{print;counter--}' file.txtThis sets a counter to 5 when a match is found, and prints and decrements the counter while it's not negative.