Need to search for *last* occurrance in a text file
Hi, I need to run a grep or whatever that returns the last line on which the target string appears, and returns it to a variable in a bash script.
Something like:
last= grep "target" myfile.txt
I know thats nothing like the right syntax but thats why I'm asking!
The target will appear many times in the file, I must get the last one only. Thanks!
|