RE: adding lines

From: Noor Mulla <Noor.Mulla_at_hcl.in>
Date: Tue, 15 Dec 2009 15:31:26 +0530
Message-ID: <2468079E02E22A47834078FE416DED3F023C3A31E6_at_BLR-HCLT-EVS06.HCLT.CORP.HCL.IN>



Kjetil,

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

How do I use 1i UNRECOVERABLE as u said instead of \n

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_at_oneteam.no] 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.


--
http://www.freelists.org/webpage/oracle-l
Received on Tue Dec 15 2009 - 04:01:26 CST

Original text of this message