RE: adding lines

  • From: Noor Mulla <Noor.Mulla@xxxxxx>
  • To: Kjetil Strønen <kjetil@xxxxxxxxxx>
  • Date: Tue, 15 Dec 2009 14:51:07 +0530

Everything is fine such that unrecoverablen (n is getting printed)



Please change it --



Ur program:

-----------

for FILE in `ls -1 *.test`

do

  mv ${FILE} ${FILE}.bkp_`date +%Y%m%d`;

  cat ${FILE}.bkp_`date +%Y%m%d` | \

   sed -e "s/^load\ data/unrecoverable\nload\ data/g" \

       -e "s/^infile\ '/infile\ 
'\/DDUMPS\/sybase_dump\/out\/DATACITI_MASTER\/Oracle\//g" \

       -e "s/^into\ table/append\ into\ table/g"  > ${FILE}; done





Other prog:

-----------

#!/bin/bash



BASE="/home/lt99068/Sybase/DATACITI_MASTER/Oracle"

for b in $(ls -1 $BASE)

do

sed -e '1i UNRECOVERABLE' -e "s/^infile '/infile 
'\/DDUMPS\/sybase_dump\/out\/DATACITI_MASTER\/Oracle\//g" \

-e "s/^into/append into/g" $BASE/$b >$BASE/$b.new; done







Thanks & Regards

Noor



-----Original Message-----
From: Kjetil Strønen [mailto:kjetil@xxxxxxxxxx]
Sent: Tuesday, December 15, 2009 2:41 PM
To: Noor Mulla
Cc: oracle-l
Subject: RE: adding lines



On Tue, 2009-12-15 at 14:22 +0530, Noor Mulla wrote:

> In the below cmd \n is not going to newline.. is the syntax fine

>

>

>

> sed -e "s/^load\ data/unrecoverable\nload\ data/g" \



Hmm. It depends on the sed-version, it seems. It works fine on the

linux-boxes I have tried, but apparently not in your version of sed.



Waldirio suggested using

------

-e "1i UNRECOVERABLE"

------

to insert UNRECOVERABLE at line 1, maybe that works better in your

environment.



--Kjetil







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: