Hi all. I am using the following to get the starting line number of some info in a log:
date +"%a %b %e"|xargs -i grep -n {} /u/informix/online.log|tail -n 1|cut -f 1 -d :|xargs -i more -p {} /u/informix/online.log
I want to take the resulting number and subtract it from the total number of lines in the log so I can tail -n just what I want to see. How can I do the math part? I thought the following would work, but I guess I just do not understand awk well enough:
date +"%a %b %e"|xargs -i grep -n {} /u/informix/online.log|tail -n 1|cut -f 1 -d :|xargs -i more -p {} /u/informix/online.log|awk "\99999 - $1"
If my approach is way off, I am open to suggestions. I need to be able to do this from a command line though, not with a script.
date +"%a %b %e"|xargs -i grep -n {} /u/informix/online.log|tail -n 1|cut -f 1 -d :|xargs -i more -p {} /u/informix/online.log
I want to take the resulting number and subtract it from the total number of lines in the log so I can tail -n just what I want to see. How can I do the math part? I thought the following would work, but I guess I just do not understand awk well enough:
date +"%a %b %e"|xargs -i grep -n {} /u/informix/online.log|tail -n 1|cut -f 1 -d :|xargs -i more -p {} /u/informix/online.log|awk "\99999 - $1"
If my approach is way off, I am open to suggestions. I need to be able to do this from a command line though, not with a script.