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
grep limitation Indalecio UNIX for Dummies Questions & Answers 6 02-10-2009 08:09 AM
Awk limitation Raynon Shell Programming and Scripting 28 09-30-2007 05:55 AM
Is this a bug or a limitation? gilberteu Shell Programming and Scripting 2 11-10-2006 06:03 AM
Limitation of ls command cskumar Shell Programming and Scripting 2 10-26-2006 10:54 AM
HP-UX 11i - File Size Limitation And Number Of Folders Limitation sundeep_mohanty HP-UX 2 08-01-2005 07:58 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 4.00 average. Display Modes
  #1 (permalink)  
Old 03-16-2009
sirababu sirababu is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 10
sed limitation of 255 characters

Gurus,

sed -e "s/\(.\{1,255\}\)\(.\{1,2\}\)\(.*\)/\1AB\3/" FILE ---this works

sed -e "s/\(.\{1,468\}\)\(.\{1,2\}\)\(.*\)/\1AB\3/" FILE ---this does not

It works only till 1,255 ( any number below 255 works)

Any one know how to increase this limit.

Thanks
Sirababu
  #2 (permalink)  
Old 03-17-2009
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
one alternative is to use perl - it has no limitations for line size

something like:
Code:
perl -pi -e 's/this/that/' /foo/bar
  #3 (permalink)  
Old 03-17-2009
wempy's Avatar
wempy wempy is offline
Registered User
  
 

Join Date: Jun 2006
Location: Harpenden, UK
Posts: 208
both lines work fine here
Code:
$ sed --version
GNU sed version 4.1.5
Copyright (C) 2003 Free Software Foundation, Inc.
If you can't use gnu sed then you could overcome the limit by
Code:
sed -e "s/\(.\{1,255\}\)\(.\{1,213\}\)\(.\{1,2\}\)\(.*\)/\1\2AB\4/" FILE
(added/altered code marked in red)
  #4 (permalink)  
Old 03-17-2009
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
GNU sed implies no limit on maximum line length
  #5 (permalink)  
Old 03-17-2009
sirababu sirababu is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 10
Quote:
Originally Posted by wempy View Post
both lines work fine here
Code:
$ sed --version
GNU sed version 4.1.5
Copyright (C) 2003 Free Software Foundation, Inc.
If you can't use gnu sed then you could overcome the limit by
Code:
sed -e "s/\(.\{1,255\}\)\(.\{1,213\}\)\(.\{1,2\}\)\(.*\)/\1\2AB\4/" FILE
(added/altered code marked in red)
Thanks a lot
Closed Thread

Bookmarks

Tags
sed

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:52 PM.


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