Issue with sed and date variable - Suffix too large - 512 max

Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Aug 2007
Posts: 34
Reputation: skelly16 is an unknown quantity at this point 
Solved Threads: 0
skelly16 skelly16 is offline Offline
Light Poster

Issue with sed and date variable - Suffix too large - 512 max

 
0
  #1
Aug 25th, 2009
Hi All

Facing issue with using sed and globally replacing a word with date variable for a sql file.

Any help would be appreciated.

Shell Scripting Syntax (Toggle Plain Text)
  1. sed -e "s/DATEST\/$DATESTART/g" $SQLREAD > $SQLNEW
  2.  
  3. sed -e "s/DATEST\/08/25/2009:07:41:41/g" /uat/ut21_sysmon/quest/foglight/JJ/jjsql
  4. Suffix too large - 512 max: s/DATEST\/08/25/2009:07:41:41/g

Thanks
Last edited by John A; Aug 26th, 2009 at 12:29 am. Reason: added code tags
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Issue with sed and date variable - Suffix too large - 512 max

 
0
  #2
Aug 25th, 2009
sed -e "s/DATEST\/08/25/2009:07:41:41/g"
One or more of the / in your dates needs escaping.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 34
Reputation: skelly16 is an unknown quantity at this point 
Solved Threads: 0
skelly16 skelly16 is offline Offline
Light Poster

Re: Issue with sed and date variable - Suffix too large - 512 max

 
0
  #3
Aug 25th, 2009
Hi Salem

I might of not explained it properly, what i pasted was the code and the output via set -v

The code in the script is this:
[sed -e "s/DATEST\/$DATESTART/g" $SQLREAD > $SQLNEW]

Basically my variable [$DATESTART = 08/25/2009:07:41:41] for example.
I need to keep the / in my date variable due to database requirements within the sql code. Is this causing the headache with Sed or is it possible to get round this, or could you suggest any other unix power tool?

Many thanks for your advice
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Issue with sed and date variable - Suffix too large - 512 max

 
1
  #4
Aug 26th, 2009
Use a different separator.
Eg.
Shell Scripting Syntax (Toggle Plain Text)
  1. sed -e "s@DATEST\@$DATESTART@g"
I can't figure out where the real separator is in the middle of the expression.
But you get the idea.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 34
Reputation: skelly16 is an unknown quantity at this point 
Solved Threads: 0
skelly16 skelly16 is offline Offline
Light Poster

Re: Issue with sed and date variable - Suffix too large - 512 max

 
0
  #5
Aug 26th, 2009
Hi Salem

Thanks!! Issue resolved, appreciate the advise with the separator

[sed -e "s@DATEST@$DATESTART@g" $SQLREAD]

Output [08/26/2009:08:31:14]

Perfect for my sql file.

Many Thanks
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC