Help with file generation


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with file generation
# 1  
Old 02-20-2015
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.
# 2  
Old 02-20-2015
You could do this in the shell script:

Code:
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.
# 3  
Old 03-02-2015
Thank you Corona688.

It worked like a champ :-)
# 4  
Old 03-19-2015
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 :-) I will try to improve this further and will let you know.

Thank you again for your time.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Xls file generation

Hi Team, Is it possible to generate the xls OR xlsx file factility in Unix and xls file should be more than one sheet. (2 Replies)
Discussion started by: bmk123
2 Replies

2. UNIX for Dummies Questions & Answers

Core File Generation

Hi I am using Linux and I am using Java as well as C++ services running on it. The ulimit -c is set to around 400Mb. Whenever any of the service fails they produce a core file.(Actual size of core could be greater than 400Mb). Whenever my Java service fails I get a core file of size 400Mb... (3 Replies)
Discussion started by: Raj999
3 Replies

3. UNIX for Dummies Questions & Answers

Log file generation from crontab

Hi All, Like to enquire whether is it possible for me to append another log file(log2.lst) using my below crontab? I will need to have 2 log files generated; one to collect the daily appended output and another log file that contains only the daily output. Original Code: 00 01 * * *... (2 Replies)
Discussion started by: snowfrost88
2 Replies

4. Shell Programming and Scripting

Dynamic file generation using shell

I have to generate the file dynamically from the source file based on the below control file. control_file.txt 1,3,5,-1,8,-1,4 The control file contain the position of column which i required from the source file, Example 1 column ,3 column ,5 column ,blank column(-1 indicates blank... (2 Replies)
Discussion started by: rspwilliam
2 Replies

5. UNIX for Dummies Questions & Answers

XML File Generation - Template Help

Hi, I have hit a bit of a brick wall.:confused: need the following code edited: echo "<?xml version=\"1.0\"?><dailyBalance_ROWSET>" > ${DataDir}/${extract_script}${ApplicationDate}.${Suffix} RunSQL ${extract_script} ${ActionFlag} echo "</dailyBalance_ROWSET>" >>... (2 Replies)
Discussion started by: Xergxes7
2 Replies

6. Shell Programming and Scripting

Unique value generation in a pipe delimited file

I have a pipe delimited file (|) with 3 columns Already i have values for 21000 records. Eg:- A|B|C EUFG|22|234 SDFG|34|345 Now i have to replace the first column A values with unique values without affecting column B and C for all the 21000 records i need to change the... (2 Replies)
Discussion started by: raakesh88
2 Replies

7. Shell Programming and Scripting

generation of control file

Hi, I wanted to create a control file with data in it. Also wanted to append more points like 1)Row count, then print the first field 2)first line of the file 3)last line of the file I started with this:- ls -ltr *.*| awk ' { print $9 "|" $7 $6 $8 "|" $5 } ' sed -n '1p'; sed -n '$p'; ... (2 Replies)
Discussion started by: alokbaba
2 Replies

8. Shell Programming and Scripting

File Report Generation

hi all i need to generate a report file that contains the following details of files present in a directory. 1. File name 2.Complete path for each files and directory 3.File size 4.Days older example i have a directory testing that contains sub-directories and some files. i need to make a... (5 Replies)
Discussion started by: yashwantkumar
5 Replies

9. Shell Programming and Scripting

file generation and mail notification

I'm very new to unix. I need help in writing a shell script that will automatically take output file from a particular folder from a server and if the file is generated send email notifications to certain group of ppl and if it is not generated send a mail wid error msg.. can any1 help me on... (4 Replies)
Discussion started by: anzie.sharma
4 Replies

10. UNIX for Dummies Questions & Answers

mail notification on file generation

I'm very new to unix. I need help in writing a shell script that will automatically take output file from a particular folder from a server and if the file is generated send email notifications to certain group of ppl and if it is not generated send a mail wid error msg.. can any1 help me on... (2 Replies)
Discussion started by: anzie.sharma
2 Replies
Login or Register to Ask a Question