|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Quickly load array?
I have a data set with names/addresses etc in it and I would like to load an array with each of the csv fields. (i.e. only read from the file one time).
The data is: "<KEYID>","<LAST>","<FIRST>","<ADDR>","<CITY>","<ST>","<ZIP>","<PHONE>" which seems prety simple until I hit the spaces in the address and city fields. NUMBER=\"<random_number>\" DATA=<data_file> I have tried: set -A REC $(grep "^$NUMBER" $DATA | tr ' ' '_' | tr ',' ' ' | tr -d '"') which gets me closes to what I want, but the address and city fields contain '_' for spaces, which I then need to strip again, but that takes too much time. Is there a more elgant way of getting this data? btw, OS is AIX 5.3 and ksh Thanks! |
|
#2
|
|||
|
|||
|
I found a way around this by setting IFS=, then just removing the ".
Thanks, RU |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Quickly load array? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|