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