FAQ
Friends

Other way

In my sample

plati:[xxx] > cat file1 | sed -e '1i\ UNRECOVERABLE' -e "s/^infile\
'/infile\ '\/DDUMPS\/sybase_dump\/out\/DATACITI_MASTER\/Oracle\//g" -e
"s/^into\ table/append\ into\ table/g"

UNRECOVERABLE

load data
infile '/DDUMPS/sybase_dump/out/DATACITI_MASTER/Oracle/DATACITI_MASTER.dbo.aspc_defaultdb.dat'
"str ''"
append into table DATACITI_MASTER.aspc_defaultdb
fields terminated by ''
trailing nullcols (
virtualid,
host CHAR(255)
)

file1 content
###
load data infile 'DATACITI_MASTER.dbo.aspc_defaultdb.dat' "str
''" into table DATACITI_MASTER.aspc_defaultdb
fields terminated by ''
trailing nullcols
(
virtualid,
host CHAR(255) )
###

Explanation

Really, the sed command doesn't work fine in Solaris (to append or
include for example), so in the command bellow, only to include the
text UNRECOVERABLE in the first line, it's necessary after 1i, you put
\^J, where you can type CTRL+V CTRL+J to generate the correct code.

plati:[xxx] > cat file1 | sed -e '1i\ UNRECOVERABLE'

So, like this plati:[xxx] > cat file1 | sed -e '1i\^JUNRECOVERABLE'

Ps. Noor, sorry for delay.

Enjoy
Waldirio

On Wed, Dec 16, 2009 at 9:53 AM, Radoulov, Dimitre
wrote:
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
--
______________
Atenciosamente
Waldirio
msn: waldirio_at_gmail.com
Site: www.waldirio.com.br
Blog: blog.waldirio.com.br
PGP: www.waldirio.com.br/public.html
--
http://www.freelists.org/webpage/oracle-l

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 11 of 17 | next ›
Discussion Overview
grouporacle-l @
categoriesoracle
postedDec 14, '09 at 10:19a
activeDec 17, '09 at 9:16a
posts17
users9
websiteoracle.com

People

Translate

site design / logo © 2022 Grokbase