The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
get next 2 lines after a "pattern line" fongthai UNIX for Dummies Questions & Answers 2 05-09-2008 01:20 AM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-19-2007 10:52 PM
How to REMOVE USER that display error --> "Name is too long" mgonzal AIX 1 06-27-2005 01:47 PM
Long time since I used "expect" scriptosaurus Shell Programming and Scripting 2 04-14-2005 12:51 PM
"Arguments too long" Peterh UNIX for Dummies Questions & Answers 2 08-12-2003 05:07 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 08-20-2008
Registered User
 

Join Date: Feb 2008
Posts: 22
Vi - "The replacement pattern is too long"

Hi,

I am trying to replace a value in a script with another value. I am performing a vi command from another script.

Code:
vi - ${conf_path}/CANCEL_CD_PART2.txt<<!
:%s/RANGE/${btch_range}/g
:wq
!
'RANGE' is the current value that the parm in the other script has (PARM1=RANGE), along with some other things. I want to substitute it with the value in $btch_range which is

Quote:
145857150104000,145857160204000,145857170104000,145857180204000,145857190204000,145857220104000,1458 57230104000,1458572401
04000,145857250104000,145857260104000,145857290104000,145857300204000,145857310104000,14585801020400 0,145858020204000,14585805010200
0,145858060104000,145858070204000,145858080104000,145858090204000,145858120104000,145858130104000,14 5858140204000,145858150304000
The values in $btch_range cannot be changed since those are batch numbers generated by the system. When I try to execute the vi command shown above, I get the following error:

Quote:
ex: 0602-075 The replacement pattern is too long. The limit is 256 characters.
Any ideas?

Thanks!
Reply With Quote
Forum Sponsor
  #2  
Old 08-20-2008
vidyadhar85's Avatar
The Tutor
 

Join Date: Jun 2008
Location: INDIA
Posts: 547
in vi editor you can replace max of 256 bytes..
so try using sed externally it allows upto 4000 chars
Reply With Quote
  #3  
Old 08-22-2008
Registered User
 

Join Date: Feb 2008
Posts: 22
Used sed

Thanks! It worked. I used the sed command instead, as you suggested.

Code:
sed "s/RANGE/${btch_range}/g" ${conf_path}/CANCEL_CD_PART2.txt > ${conf_path}/CANCEL_CD.txt
Reply With Quote
  #4  
Old 08-22-2008
Registered User
 

Join Date: Aug 2008
Posts: 15
or you could set range to the variable not to the value contained in that variable :

Code:
:%s/RANGE/\${btch_range}/g
notice the "\" before the "$"

so before we have:
Code:
PARM1=RANGE
and after we have:

Code:
PARM1=${btch_range}
as long as this is inside a shell script, if it is in a conf file that will not expand the variable ${btch_range} (replace the variable with it's value when read) then the previous answer is what you want.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:18 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0