I want to be able to print the number of lines from bash as such: Line number (as counted from the top) -> end of the file
It seems tail will only count lines from the bottom.
Does anyone know how to do this? Thanks.
I've tried the following
# Where $1 is the file I'm reading in
# Get line number of error:
LINENUM=$( grep -n "$LAST_ERROR_DATE" $1 | egrep $LOG_THRESHOLD | grep $LAST_HOUR: | sed 's/:/ /g' | awk '{print $1}' | head -n 1 )
echo $LINENUM
# This returns 995
# Print everything from linenumber downwards
MESSAGE=$( awk 'NR >= $LINENUM' $1 )
This works when I manually pop in 995 to awk instead of $LINENUM, it doesn't seem to read in my bash variable. Any ideas?