Re: adding lines

From: Radoulov, Dimitre <cichomitiko_at_gmail.com>
Date: Wed, 16 Dec 2009 12:53:18 +0100
Message-ID: <4B28CA2E.9040907_at_gmail.com>



On 16/12/2009 12.42, Radoulov, Dimitre wrote:
> On 16/12/2009 12.16, Noor Mulla wrote:
>>
>> Anyone in the position to convert below script which is using *sed*
>> to a script using *awk*. Basically, we are adding *unrecoverable,
>> path ddumps/../../dataciti_master *and* append* to existing ctl
>> files. This is very urgent.
>>
>> for FILE in `ls -1 *.test`
>>
>> [...]
>>
>
> I believe this is off-topic here ...
> Anyway (backup your data before running the script, or just change /mv
> /to /cp/):
>

... and this will take care of eventual pathological characters in your ctl filenames.

awk 'END { close(fn); system("mv " fn " " ofn) } FNR == 1 {
   if (fn) { close(fn); system("mv \47" fn "\47 \47" ofn "\47") }    print "unrecoverable" > (fn = FILENAME "__new")    ofn = FILENAME
   }
{

   sub(/infile \47/, "&/DDUMPS/sybase_dump/out/DATACITI_MASTER/Oracle/")    /into table/ && $0 = "append " $0; print > fn    }' *.ctl

Regards
Dimitre

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Dec 16 2009 - 05:53:18 CST

Original text of this message