59 How to find line number which is longest in file?

awk '{ print length(), NR | "sort -rn" }' index.tex | head -n 1
 

This prints 2 numbers on the screen. The first number is the actual length and the second number is the line number itself in the file.

Thanks to Attila O. https://askubuntu.com/questions/375832/how-to-get-longest-line-from-a-file