Hi Kaushik,
Try removing the "$" in ALL the array references,
for example: my_Array[$arr_Index] becomes my_Array[arr_Index]
Ambo
The bit of code I'm using to do this operation is as under -
awk -F"-!-" 'BEGIN{ TotalAlarms=0; InvalidAlarms=0;
OutstandingAlarms=0; TerminatedAlarms=0; AcknowledgedAlarms=0 }
/\/,/\/ {}
/^/ { arr_Index = 0 }
{
if ( $0 !~ /^/ && $0 !~ /^/ )
{
#printf "Line : %s\n", $0
#count = split ($0,Array,"-!-")
my_Array[$arr_Index]=sprintf("%s",$0)
printf ("-- Array %s : @ %d \n",my_Array[$arr_Index],arr_Index )
arr_Index++
}
if ( $0 ~ // )
{
print "Hope to see something in the array\n"
for ( i=0; i <= arr_Index; i++ )
{
printf ("Array Here @ %d is %s \n",i,my_Array[$i] )
}
}
}' /tmp/Recordfile
I'm unable to print the values stored in the array in the print statement
if ( $0 ~ // )
{
print "Hope to see something in the array\n"
for ( i=0; i <= arr_Index; i++ )
{
printf ("Array Here @ %d is %s \n",i,my_Array[$i] )
}
}
Can someone please help.
Thanks and regards
Kaushik
---------------------------------
Looking for earth-friendly autos?
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
[Non-text portions of this message have been removed]