Using awk, I would like to print the last matching line of a file. I would like only the matching line itself, not any range of lines. I can use a command like this
awk '/foo/' bar.txt However this will print all matching lines, not just the last one.