Nagen Acharya
Nagen Acharya

Reputation: 1

Sed command for replace date

I have a SQL query in a file which is used a where clause VRFRV_DT = TO_DATE('$RUN_DT','MM-DD-YYYY')), I want to replace this $RUN_DT in my shell script with $to_run_Dt variable which is in (11/05/2018) format. I have written a sed command like below, but it's not parsing. Could you please anyone help me here? Thanks in advance.

sed 's/\$TO_RUN_DT/'$RUN_DT'/g'<<< "$q2"

Upvotes: 0

Views: 269

Answers (1)

perreal
perreal

Reputation: 97948

You can change the substitute delimiter:

sed 's!\$RUN_DT!'$RUN_DT'!g' <<< "$q2"

Upvotes: 1

Related Questions