943,904 Members | Top Members by Rank

Ad:
Aug 25th, 2009
0

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

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
skelly16 is offline Offline
34 posts
since Aug 2007
Aug 25th, 2009
0

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

sed -e "s/DATEST\/08/25/2009:07:41:41/g"
One or more of the / in your dates needs escaping.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Aug 25th, 2009
0

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

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
Reputation Points: 10
Solved Threads: 0
Light Poster
skelly16 is offline Offline
34 posts
since Aug 2007
Aug 26th, 2009
1

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

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.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Aug 26th, 2009
0

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

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
Reputation Points: 10
Solved Threads: 0
Light Poster
skelly16 is offline Offline
34 posts
since Aug 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: How not to show messages?
Next Thread in Shell Scripting Forum Timeline: date command





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC