Hi All

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

Any help would be appreciated.

sed -e "s/DATEST\/$DATESTART/g" $SQLREAD > $SQLNEW

sed -e "s/DATEST\/08/25/2009:07:41:41/g" /uat/ut21_sysmon/quest/foglight/JJ/jjsql
Suffix too large - 512 max: s/DATEST\/08/25/2009:07:41:41/g

Thanks

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

Use a different separator.
Eg.

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.

Comments
i didn't know you could switch separator chars

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

This question has already been answered. Start a new discussion instead.