Can someone show, how to use awk command to identify the longest line in a text file.
Thanks
To print the longest line:
awk 'length > m { m = length; a = $0 } END { print a }' input-file
To simply identify the longest line by line number:
awk 'length > m { m = length; a = NR } END { print a }' input-file
awk '{ if (length($0) > longest) longest = length($0); } END { print longest }'