[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
reading a TAB-separated file
From: |
Nicolai Stange |
Subject: |
reading a TAB-separated file |
Date: |
Sat, 16 Sep 2006 13:18:20 +0200 |
User-agent: |
KMail/1.9.4 |
Hi,
i want to read a file whith tab-separated columns.
I cannot use the Octave or octave-forge function because I need to create a
Matrix containing the real strings and NOT data of internal type number for
later obtaining of the precision of data entered in the file (it's data from
experient and I must know precision).
I want to allow multiple tabs next to each other an whitespace in front and on
the back of each columns.
For example
string1, string1 continued \t\t string2 \t string3
My strategy is to read line by line and separate a line into its pieces.
Note: My regexp in octave 2.1.73 FIRST needs the pattern and then the string
not as stated in online documentation. And it doesn't take any options
argument.
So: Find the position of tabs and spaces following and preceeding them and
substr the other part with the data:
regexp (\\s*\t+\\s*, line)
Problem: This regular expression ONLY finds the first occurence and position
goes only until the last tab in the first columns separation NOT including
the damn whitespace between "\t\t" and "string2".
Any hints?
Thank you very much
Sincerely yours
Nicolai Stange
pgpA028Rr3gru.pgp
Description: PGP signature
- reading a TAB-separated file,
Nicolai Stange <=