Read and Write to same file in Unix Shell Script [message #314384] |
Wed, 16 April 2008 09:10 |
ritvikd
Messages: 11 Registered: January 2007
|
Junior Member |
|
|
Situation is:
A batch program in Unix have created a file having records in it.
This file is flat file and data items in this file is position specific as per Low level document. One of the data item from position 2648-2665 is incorrect (length is 18 characters and data item is numeric). Incorrect means that this position should have decimal value but it is having whole number.
Plan is to write a sql script and pass the paramter to this sql script via shell script. The shell script will read from the file and pass the primary keys to sql script by traversing the line.
This sql script will find the correct information and pass back the correct value.
Capture this value and replace the value at the specific postion 2648-2665 by the capture value. Once all the file is read; save the file.
We have already completed with the sql script, passing the parameters and capturing the output parameters is not a problem. The problem here is we need to read and write to the same file.
Is it possbile?
Thanks
|
|
|
|