The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Counting the number of occurances of all characters (a-z) in a string rsendhilmani Shell Programming and Scripting 5 08-05-2008 12:10 PM
read string, check string length and cut ozzy80 Shell Programming and Scripting 9 03-21-2007 05:56 PM
sed problem - replacement string should be same length as matching string. amangeles Shell Programming and Scripting 4 01-11-2006 06:11 AM
String length in ksh ssgrpid Shell Programming and Scripting 4 08-03-2005 01:39 PM
Counting patterns in a shell string kevin80 UNIX for Dummies Questions & Answers 3 06-03-2003 09:34 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-23-2007
ganesh123 ganesh123 is offline
Registered User
  
 

Join Date: Feb 2007
Location: Milwaukee
Posts: 24
Counting the max length of string

Hi all,

I have a flat file of 1000 rows. I want to check the length of the 5th column. The one having the longest length , I want to set it as DEFINED PARAMETER.
So later I can check others with that particular number only.

Any ideas ??
  #2 (permalink)  
Old 02-23-2007
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
Code:
awk ' length($5) > len { len=length($5) } END { print len } ' file
  #3 (permalink)  
Old 02-23-2007
ganesh123 ganesh123 is offline
Registered User
  
 

Join Date: Feb 2007
Location: Milwaukee
Posts: 24
thanks anbu
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:14 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0