0

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

2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by skelly16
Featured Replies
  • 1
    Salem 5,138   7 Years Ago

    Use a different separator. Eg. [code] sed -e "s@DATEST\@$DATESTART@g" [/code] I can't figure out where the real separator is in the middle of the expression. But you get the idea. Read More

0

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

1

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
0

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.
Take the time to help us to help you. Please be thoughtful and detailed and be sure to adhere to our posting rules.