Location: India [Great India] hey hey .. urs also greaty country frnd
Posts: 60
Thanks Given: 0
Thanked 0 Times in 0 Posts
Explain this AWK script plz
Hi frnds,
one my frnds has given resolution for my problem as below. it working great , but i couldnt understand somethings in the script.
Why ++ operator after the function calling. how these each block working. will each run for each input line sequencially or one block for all the lines and next block execeted? plz clarify.
So, what is the problem u have to resolve ??? It's better to know the requirements (input/output) and the solution than just the solution, right ?
plz clarify ^__^
Location: India [Great India] hey hey .. urs also greaty country frnd
Posts: 60
Thanks Given: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by thanhdat
So, what is the problem u have to resolve ??? It's better to know the requirements (input/output) and the solution than just the solution, right ?
plz clarify ^__^
[Code
Hi thanhdat
Plz look into my actual posting and plz explan me the AWK script that one of our frnd given as a solution.Plzzz
Execute awk script for the input file ora.log.
The variable Outfile is initialized, before executing the awk script, with the output file name
Records starting with 'ORA-' are selected..
The Oracle error text is memorized in the variable Ora_error
Records containing 'Targ RowId=' are selected.
The number of rejected records found is incremented (variable Rejected_count).
The following records will contain the columns details ending with the ')' record.
The variable Get_detail, which is set to TRUE (value 1),indicates that we are now reading for columns details.
Records starting with ')'' are selected if we are reading columns details.
There is no more columns details records for this rejected record, so the memorized values of columns are writen in the output file.
The variable Get_detailis set to FALSE (value 1),
Records are selected if we are reading columns details.
The value of the column is memorized in the [/I]Values_detail[/I] variable.
Location: India [Great India] hey hey .. urs also greaty country frnd
Posts: 60
Thanks Given: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by aigles
Execute awk script for the input file ora.log.
The variable Outfile is initialized, before executing the awk script, with the output file name
Records starting with 'ORA-' are selected..
The Oracle error text is memorized in the variable Ora_error
Records containing 'Targ RowId=' are selected.
The number of rejected records found is incremented (variable Rejected_count).
The following records will contain the columns details ending with the ')' record.
The variable Get_detail, which is set to TRUE (value 1),indicates that we are now reading for columns details.
Records starting with ')'' are selected if we are reading columns details.
There is no more columns details records for this rejected record, so the memorized values of columns are writen in the output file.
The variable Get_detailis set to FALSE (value 1),
Records are selected if we are reading columns details.
The value of the column is memorized in the [/i]Values_detail[/i] variable.
Display statistics at end of file.
My apologies for my poor English.
Jean-Pierre.
Hi Thanks for you reply
but tell me what you mean by "column details"?
found this handy one liner in another thread which is closed, it does what i need but im trying to understand it. it basically matches the field that contains the value v and prints its position
awk -F, '{for(i=1;i<=NF;i++)if($i==v)print i}' v=yourfield inputfile
my understanding is assign... (3 Replies)
can u explain this step by step........plz...will it do the same
for I in *.tar.gz; do
A=`basename $I .tar.gz`
mkdir $A
cp marking-guide ${A}/$A
cd $A
gunzip -c ../$I | tar xf -
cd..
done
thnx
__________________ (2 Replies)
hi all
i wrote a shell script which uses perl script my code is :
>cat filename | while read i
>do
>perl -e 'require "/home/scripts/abc.pl" ; abc("$i")'
>done
perl script used will simply check syntax of Cobol programs but it didn't work for me so i asked my colleague he suggested... (1 Reply)
hi buddies
pls help in this matter
i have file like this input file
--------------------------
(PARTITION PARTITION_1 VALUES LESS THAN (101, 16383 ) TABLESPACE PART_1
,PARTITION PARTITION_2 VALUES LESS THAN (101, 32766 ) TABLESPACE PART_2
,PARTITION PARTITION_3 VALUES LESS THAN (101,... (3 Replies)
I have a file like this I have to
I have input file this , I want to give the out put in the below
input file
(NARAYANA 1 ENDING AT (100, 16383)
,NARAYANA 2 ENDING AT (100, 32766)
,NARAYANA 3 ENDING AT (100, 49149)
,NARAYANA 4 ENDING AT (100, 65535)
,NARAYANA 5... (8 Replies)
Hi,
I found this command in this forum, but, couldnt understand much from it.
could any one help me understand that???
the commands are :
awk '{sub(/ ~/,""); printf $0 ($0~/\|$/?ORS:"")}' file1 > file2
awk '{sub(/~ */,x);printf $0(/\|$/?ORS:x)}'
awk '{sub(/~ */,x);sub(/\|$/, "|\n")}8'... (4 Replies)