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
limit of command length Anta UNIX for Dummies Questions & Answers 2 10-11-2008 04:08 PM
Is the Length of User ID for AIX Limit to 8 Characters? meihua_t AIX 2 04-07-2008 02:04 AM
line length Sreejith_VK Shell Programming and Scripting 4 03-10-2008 10:46 AM
Grep line length constraint problem - help! jvander Shell Programming and Scripting 23 05-09-2005 08:44 AM
Command line buffer limit? kornshellmaven UNIX for Dummies Questions & Answers 7 01-07-2003 11:59 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-01-2006
hnhegde hnhegde is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 22
grep line length limit

Hi Friends,

I am having a funny problem with grep. When I run
grep 'expr' file.txt
things work fine. But when try to get the line number using the -n option, i.e,
grep -n 'expr' file.txt
I get a message, "grep: 0652-226 Maximum line length of 2048 exceeded."

If the line has more than 2048 characters, then I should have got the error in the first case also. Can somebody please explain why the error is only with the -n option? I am running on AIX 5.1.0.0

Thanks.
  #2 (permalink)  
Old 10-02-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,643
As a guess - the line length is 2045. When grep attempts to write the line number
plus the original line, then the 2048 limit for I/O is exceeded.

Edit -
I cannot duplicate this problem, the line size limit is not the same.

Last edited by jim mcnamara; 10-02-2006 at 11:25 AM..
  #3 (permalink)  
Old 10-02-2006
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,422
Quote:
Originally Posted by hnhegde
Hi Friends,

I am having a funny problem with grep. When I run
grep 'expr' file.txt
things work fine. But when try to get the line number using the -n option, i.e,
grep -n 'expr' file.txt
I get a message, "grep: 0652-226 Maximum line length of 2048 exceeded."

If the line has more than 2048 characters, then I should have got the error in the first case also. Can somebody please explain why the error is only with the -n option? I am running on AIX 5.1.0.0

Thanks.
That's where you do not have control...over the tools you use.
If you have Python in your AIX already:
Code:
for linenum, lines in enumerate(open("file.txt")):
     if "expr" in lines:
          print "Line number: " , linenum
  #4 (permalink)  
Old 10-02-2006
hnhegde hnhegde is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 22
Thanks Jim. That might be the cause.
Sponsored Links
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 06:25 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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