RE: adding lines

From: Noor Mulla <>
Date: Thu, 17 Dec 2009 11:49:05 +0530
Message-ID: <2468079E02E22A47834078FE416DED3F023C3DD80D_at_BLR-HCLT-EVS06.HCLT. CORP.HCL.IN-B3414CAA-8720-03B8-A1F6-E22BF6DC8159>

Hi Dimitre,

Encountering error as below when I ran ur script

awk: syntax error near line 2
awk: bailing out near line 2

Thanks & Regards

From: Radoulov, Dimitre [] Sent: Wednesday, December 16, 2009 5:23 PM To: Noor Mulla
Cc: oracle-l
Subject: Re: adding lines

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



The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any mail and attachments please check them for viruses and defect.

Received on Thu Dec 17 2009 - 00:19:05 CST

Original text of this message