Print everything after the last occurrence

This may be long and convoluted but it is the first thing that came to mind and it worked.

Had a log file that would delimit with "As Of nn/nn/nnnn" which could be multimegabytes. Didn't feel like doing a perl solution that day, so:

grep -n 'As Of' sourcefile | tail -1 | awk -F":" '{print $1}' | xargs -r -iX awk 'FNR>=X' sourcefile > outfile

Again, likely an easier solution, but this was Q&D.

Comments

No comments.