UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 30th, 2006, 12:09 AM
RULost RULost is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 4 RULost User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 17 sec
Reputation Power: 0
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!

Reply With Quote
  #2  
Old September 30th, 2006, 11:16 AM
RULost RULost is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 4 RULost User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 17 sec
Reputation Power: 0
I found a way around this by setting IFS=, then just removing the ".

Thanks,
RU

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Quickly load array?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway