Re: READ and delimited format




Jeremy wrote:
Is it possible to use READ to read a delimited file? i.e.:

JOHN|DOE|123 MAIN ST.|SMALLTOWN|NJ|USA
JOE|SMITH|1 S. MAIN ST. APT 25|BIGTOWN|CA|USA

With a little work, yes. If you want to store the characters between
"|" in separate strings, you can

(1) Read each line into a large string with an "internal read"

read (iunit,"(a)") text

(2) Loop through "text" to determine the positions of the the
delimiters.

(3) Use character substring operations to store the appropriate parts
of "text" in separate character variables. For example

cc(1) = text(1:10) ; cc(2) = text(12:15)

if delimiters appear in the 11th and 16th positions of "text".

.



Relevant Pages

  • Re: hash
    ... # push each store into array associated with its parent store ... elsif($size_type eq "Euro") { ... sub xmlEscape ... Usually it is an ASCII control character. ...
    (perl.beginners)
  • Re: identifying most recently used symbol (via VBA) in MSO2003, as
    ... > document is always a left parenthesis regardless of what character you ... > dialog and store them separately. ... > Sub InsertSymbol() ... > ' where they can be read by another macro that needs to know ...
    (microsoft.public.word.vba.general)
  • RE: Split non delimited data into multiple cells
    ... I used a column as a counter, and then used the mid statement in separate ... It separates each character into its own cell. ... charcter of the string in its own cell. ... I am importing an ascii file and can separate the data manually during ...
    (microsoft.public.excel.worksheet.functions)
  • Re: output problem
    ... This line reads characters from stdin and stores ... When it finds a non-white character, ... Just as with the first scanf(), ... this call will discard the left-over '\n', store "Wiener" ...
    (comp.lang.c)
  • Re: LOB segment space usage
    ... UCS2character set, that means, you store not 2048 bytes, but 2048 ... I have UTF8 as national character set and I ... SCOTT@andrkydb> truncate table t1; ...
    (comp.databases.oracle.server)