Longest line in a file

Andrew Prock picture Andrew Prock · Oct 31, 2009 · Viewed 96.5k times · Source

I'm looking for a simple way to find the length of the longest line in a file. Ideally, it would be a simple bash shell command instead of a script.

Answer

Daniel picture Daniel · Jul 7, 2010

Using wc (GNU coreutils) 7.4:

wc -L filename

gives:

101 filename