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 > 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 04:20 AM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-20-2007 01:52 AM
How to REMOVE USER that display error --> "Name is too long" mgonzal AIX 1 06-27-2005 04:47 PM
Long time since I used "expect" scriptosaurus Shell Programming and Scripting 2 04-14-2005 03:51 PM
"Arguments too long" Peterh UNIX for Dummies Questions & Answers 2 08-12-2003 08:07 AM

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 Rate Thread Display Modes
  #1 (permalink)  
Old 08-20-2008
hern14 hern14 is offline
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!
  #2 (permalink)  
Old 08-20-2008
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,390
in vi editor you can replace max of 256 bytes..
so try using sed externally it allows upto 4000 chars
  #3 (permalink)  
Old 08-22-2008
hern14 hern14 is offline
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
  #4 (permalink)  
Old 08-22-2008
ddreggors ddreggors is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 91
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.
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 09:37 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