Re: AWK for update INITIAL - Oracle

  • From: Eriovaldo Andrietta <ecandrietta@xxxxxxxxx>
  • To: Phillip Jones <phil@xxxxxxxxxx>
  • Date: Sun, 10 Jul 2011 11:29:21 -0300

Hi Phil,

  Very easy, as you said.
  It worked fine as expected.

  Look at this:

  source data:

INITIAL 1000 AAA
INITIAL 2000 AAA
INITIAL 3000 AAA
INITIAL 4000 BBB

 the script:

#!/bin/sh
cat lista | while read arq
do
 echo $arq | awk '{ sub(/INITIAL [0-9]/,"INITIAL 8124"); print }'
done

 after running the script the result is:

INITIAL 8124000 AAA
INITIAL 8124000 AAA
INITIAL 8124000 AAA
INITIAL 8124000 BBB

Note: In order to get the purpose I need to run again like that:

#!/bin/sh
cat lista | while read arq
do
 echo $arq | awk '{ sub(/INITIAL 8124000/,"INITIAL 8124"); print }'
done


Issue solved.
Thanks for help.

Best Regards
Eriovaldo



On Sun, Jul 10, 2011 at 9:30 AM, Phillip Jones <phil@xxxxxxxxxx> wrote:

> Hi,
>
> It's easy with sed:
>
> sed 's/INITIAL [0-9]*/INITIAL 8124/'
>
> Thanks,
>
> Phil
>
> On Sun, Jul 10, 2011 at 12:55 PM, Eriovaldo Andrietta <
> ecandrietta@xxxxxxxxx> wrote:
>
>> Hi friends,
>>
>>   I generated a file using imp / indexfile in order to know objects inside
>> the .dmp.
>>   Then I saw that the initial value is too big to import it.
>>
>>   How can I do an awk code in order to change the folloing string :
>>
>>       from     INITIAL 52428800 FREELISTS
>>       to        INITIAL 8124 FREELISTS
>>
>>   Note: in the indexfile has a lot of initial values different, so the awk
>> must consider different values.
>>
>>   I have this one, but I don´t know how to get and change the old value
>> (the next word after the word "INITIAL".
>>
>>   Look:
>>
>>            cat lista1 | awk '{ sub(/INITIAL/, "INITIAL 8124"); print }'
>>
>> Best Regards
>> Eriovaldo
>>
>>
>>
>

Other related posts: