Link to home
Start Free TrialLog in
Avatar of gannev
gannev

asked on

Read a file and store in Arrays in Kshell script

Hi Experts,

I am new to Kshell programming.
I need some help regarding
1. Read  a file from a location( eg for file is   abc,bcd,cde,erf)
2.take a while loop and create an arraylist
  read the the content of the file into the arraylist(with , delimeter) like arraylist[0]=abc
arraylist[1]=bcd .
till the end of the file.

Can you please provide me a script to do this.

Thanks,
Ganne
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tintin
Tintin

Do you really need to use arrays?  What problem are you trying to solve?
Why use array?
The Ksh array can have a MAX 512 elements. [0-511],  it will cause
trouble if you have >512 files in a dir!

what do you want to do with the file contents once you have read them