RE: adding lines

  • From: Noor Mulla <Noor.Mulla@xxxxxx>
  • To: "Radoulov, Dimitre" <cichomitiko@xxxxxxxxx>
  • Date: Thu, 17 Dec 2009 11:49:05 +0530

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
Noor


From: Radoulov, Dimitre [mailto:cichomitiko@xxxxxxxxx]
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



Regards
Dimitre

DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

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.

-----------------------------------------------------------------------------------------------------------------------

Other related posts: