[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Finding & printing the longest line



On Thu, 31 Aug 2000, Eric Sisler wrote:

> Ok, stupid question of the day.
> 
> I'm trying to find & print (dump to a file) the longest
> line in a text file.  I've been able to determine the
> *length* of the longest line by using the 'wc -L' command,
> but is there any way using find or some other command to
> *output* the longest line? 
> 

Like:

 gawk 'length > O { O=length; L=$0 }; END { print O,L }' your_file


-- 
John Darrah (u05192)	| Dept: N/C Programming
Giddens Industries	| Ph: (425) 353-0405 #229
PO box 3190		| Ph: (206) 767-4212 #229
Everett  WA    98203	| Fx: (206) 764-9639





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]