Help with file generation

Dear all

Hope you are doing good.

I've requirement where in I need to generate a file containing set of SQLs as per the inputs.

My script flow is like reading few parameters using read command to read input to script and process the inputs. However at one of the input, my script has to take input as huge number of lines (lines will be DDL of create table statement with special characters like single quotes). I'm getting these lines in text file and copying them and giving it as input to script by right clicking mouse in putty session. The moment I do the right click, my script is failing.

Please advise on how to handle this. The DDL statements will be received via text file

Thank you all in advance.

You could do this in the shell script:

cat > outputfile

...then paste your data into the terminal. To finish, type ctrl-D. The terminal will understand ctrl-D to mean 'end of file', causing cat to stop reading and quit politely and allowing the shell script to continue. The contents will end up in outputfile.

This is difficult to automate -- it needs a terminal to work, a ctrl-D character in a file won't cut it -- but the process doesn't sound very automatic at this point.

It worked like a champ :slight_smile:

Thank you very much Corona688 and sorry for delay in response.

You are very correct about this process not being automatic. However, the requirement is met for :slight_smile: I will try to improve this further and will let you know.

Thank you again for your time.