What's the best way of getting only the final match of a regular expression in a file using grep?
Also, is it possible to begin grepping from the end of the file instead of the beginning and stop when it finds the first match?
You could try
I am always using cat (but this makes it a little longer way): cat file | grep pattern | tail -1
I would blame my linux admin course teacher at college who love cats :))))
-- You don't have to cat a file first before grepping it. "grep pattern file | tail -1" and is more efficient, too.