Making Variables

Dear Friends,
Here I need your help once again.

I have a flat file with pipe de-limited format

e.g. 12345|1234567890|0|0|0|
(Total 5 values)

I want to take all non 0 ("Zero") values in variables named as anu1, anu2, anu3, anu4 and anu5.
Is it possible?

Please guide me.
Thank you in advance.
Anushree

what about the other rows?
also depends how you want to use the variables.
one way:

while IFS="|" read a1 a2 a3 a4 a5
do
 echo $a1,$a2,$a3,$a4,$a5
done < file

you can have checks for non-zero values as per your requirement.

Hi,

Try this,

#!/usr/bin/perl

while (<>) {
chomp;
@array = split /\|/;
for ($i=0;$i<$#array;$i++)
{
if ( $array[$i] eq 0 ) { print " $array[$i] : - Zero\n" ;}
else { print "$array[$i] : - Non Zero \n"; }
}
}


perl script.pl input_filename

[/CODE]

Thanks Anchal, and Thanks Pravin for the prompt responce.
I have tried Anchal's solution which worked fine only prob is it is not ignoring "Zeros", but its fine I think i can now manage those zeros.

Thank you again for both the solutions.
Take care, God bless you
Anushree