|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Find the length of the longest line
Dear All,
To find the length of the longest line from a file i have used wc -L which is giving the proper output... But the problem is AIX os does not support wc -L command. so is there any other way 2 to find out the length of the longest line using awk or sed ? Regards, Pankaj |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Code:
awk ' { if ( length > x ) { x = length } }END{ print x }' filename |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Longest length of string in array | mmab | Shell Programming and Scripting | 12 | 12-14-2011 12:14 PM |
| Display all the words whose length is equal to the longest word in the text | bawse.c | UNIX for Dummies Questions & Answers | 4 | 08-14-2011 06:32 AM |
| Find longest string and print it | SEinT | Shell Programming and Scripting | 6 | 04-20-2011 07:39 AM |
| Find the length of each line in the file | Suryaaravindh | Shell Programming and Scripting | 7 | 02-26-2011 07:38 AM |
| Bash script find longest line/lines in several files | 1tempus1 | Shell Programming and Scripting | 23 | 10-27-2010 12:33 PM |
|
|