0

Below is my bash variable

column_list=col1,col2,col3

sql.txt file has below sql

select column_list from table

using sed to replace column_list dynamically according to the table

sed -i "s/COLUMN_LIST/'$COLUMN_LIST'/g;" sql.txt

but the sed command fails because of the commas in the column_list variable how to modify sed to do this?

1
  • 4
    You seem to be using column_list as the variable name in your assignment, but then you refer to a variable COLUMN_LIST in the sed command. You also do not say what error you're getting.
    – Kusalananda
    Jun 23 at 16:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.