LZhang
17 years agoFrequent Contributor
How to exact a particular column from an external file
Hi, Ole:
I have a txt file named tc_list.txt, and it looks like this:
tc_name1, user1, tel1,
tc_name2, user2, tel2.
tc_name3, user3, tel3,
tc_name4, user4, tel4,
tc_name5, user5, tel5
It has 5 rows in total and each field is delimited by a comma. I want to read in the file but extract and store only the FIRST column ("tc_name") to an array called list. I tried using spliteachline(",") function but it didn't work. Do you have a better way of doing that?
Thanks,
Li
I have a txt file named tc_list.txt, and it looks like this:
tc_name1, user1, tel1,
tc_name2, user2, tel2.
tc_name3, user3, tel3,
tc_name4, user4, tel4,
tc_name5, user5, tel5
It has 5 rows in total and each field is delimited by a comma. I want to read in the file but extract and store only the FIRST column ("tc_name") to an array called list. I tried using spliteachline(",") function but it didn't work. Do you have a better way of doing that?
Thanks,
Li