Flat File Conversion Format

Hi all,

I've a flat file in this format:
[] = [2 empty lines]
"
Record 1
[]
Field1 -> XXXX
Field2 -> 9558
Field3 -> 55AA
[]
Record 2
[]
Field1 -> YYYY
Field2 -> 12345
Field3 -> aa23
[]
"

And i want to convert it to

XXXX|9558|55AA
YYYY|12345|aa23

so it can be loaded into an oracle table;

Any sugestions; (awk)?

Thnks in advance

awk 'BEGIN{OFS="|"} /Field/ {f1=$3;getline;f2=$3;getline;f3=$3; print f1,f2,f3;}' filname

awk 'BEGIN { FS ~ /->/ ; count=0 }
{ if (NF != 3 ) next ;
outstr="" ;
do { outstr = outstr $3 "\|" ; count++ ; }
while ( count%3 != 0 && getline );
printf "%s\n", substr(outstr, 0, length(outstr)-1) }' /u01/old_record_file

In case above not work perfectly for you then please put your valuable time as well  ;\)

Hi,
I don't understand the meanig of "/u01/old_record_file";
I've got 57 fields, so i replace 3 for 57 everywhere and i'm executing this like:
in=$1
out=$2
cat $in | "your co0de" > $out [i removed the above path from the code"

I didn't work... (the format is as follow).

[empty line]
[empty line]
Record -> 1
[empty line]
[empty line]
Field1 ->12345
Field2 ->AAAA
Field3 ->5245A
[empty line]
[empty line]
Record -> 2
[empty line]
[empty line]
{another record}

Hi sumit,

I�ve altered the code to:

cat $in | awk 'BEGIN { FS ~ /->/ ; count=0 }
{ if (NF != 3 || substr($1,1,6)=="Record") next ;
outstr="" ;
do { outstr = outstr $3 "|" ; count++ ; }
while ( count%57 != 0 && getline );
printf "%s\n", substr(outstr, 0, length(outstr)-1) }'

And it work's just fine. Thnks.
Much regards.
L