in reply to replace string from Command Line

s/CAST(CAST(hs_date AS DATE FORMAT … ^ ^

Parentheses are special in Perl regular expressions.