Read a Tab-delimited file and break it into its component columns

I need a code snippet that will read a tab delimited test file and break each record into its component pieces that are delimited by the tab.  I need this in Classic ASP, not ASP.NET

Thanks,
ARW
ARWAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

WMIFCommented:
you would use the split command.  you have a couple options.  read line by line and split each line, or read all the text and split the lines out then split each line.

tempall = objfso.readall
lines = split(tempall,vbcrlf)
for i = 0 to ubound(lines)
  line = split(lines(i),vbtab)
next


where are you planning to go with the data?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ARWAuthor Commented:
I want to stick the data in separate arrays representing the different columns.
arw
jitgangulyCommented:
<%

dim sPath,objFso
strPath = Server.MapPath("MyFile.csv")
Set objFso = createObject("Scripting.FileSystemObject")
Set objTxtStream = objFso.OpenTextFile( strPath )

Dim strSQL
Dim i, myArr, theLine

While not objTxtStream.AtEndOfStream
theLine = objTxtStream.ReadLine

myArr = split(theLine, chr(9))
i = 0

str1     = myArr(i)
str2      = myArr(i+1)
str3     = myArr(i+2)
str4      = myArr(i+3)
str5     = myArr(i+4)
str6      = myArr(i+5)
str7      = myArr(i+6)
str8      = myArr(i+7)
str9      = myArr(i+8)
str10      = myArr(i+9)
str11      = myArr(i+10)
str12      = myArr(i+11)
str13      = myArr(i+12)
str14      = myArr(i+13)
str15      = myArr(i+14)
str16      = myArr(i+15)
str17      = myArr(i+16)
str18      = myArr(i+17)
str19      = myArr(i+18)
str20      = myArr(i+19)
str21      = myArr(i+20)
str22      = myArr(i+21)
str23      = myArr(i+22)
str24      = myArr(i+23)
str25      = myArr(i+24)

wend
                   
%>
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

ARWAuthor Commented:
So the split command automatically knows to split these columns into the array?

ARW
WMIFCommented:
yes.  it splits the text based on the delimiter you give it.  then you access the columns through the index of the array.
jitgangulyCommented:
Split returns array and you use index to access each element. See my example above
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.