Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

picking up values from a comma separated external file

Status
Not open for further replies.

ianholmes

Programmer
Mar 24, 2001
61
GB
How do I do the above ?
I have a file A, which looks like
a,b,c c,dddd
e,f,g g,hhhh
etc etc
I need to do something like :-
while read f1 f2 f3 f4
do
........
done < file A

But f1 comes over with the whole line, and f2 f3 f4 are not set.
How do I tell it to recognise the commas as the field separators ?
Editing file A to replace the commas with spaces is not on, as f3 contains spaces.
Hope someone can help.
Thanks
 
Try...
[tt]
while IFS=, read f1 f2 f3 f4
do
:[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top