From: Nuno R. L. Ferreira (nunolf_at_ci.uc.pt)
Date: Mon Feb 13 2006 - 08:10:20 CST

Hi Anna

I did not understood very well your question, but how about:

set infile [open textfile r]

while {[gets $infile line] >=0}
   # reads 4th column
   set value [lindex $line 3]
   # do something with $value
   puts $value
}

  ----- Original Message -----
  From: Anna Modzelewska
  To: vmd-l_at_ks.uiuc.edu
  Sent: Monday, February 13, 2006 1:35 PM
  Subject: vmd-l: tcl-reading files

  Hello,

  I'm writing a tcl script in which I need to read numerical values of variable length from a file.
  Is there any simple way to read from files string after string and not sign after sign?

  To make the question more clear, the lines are:
  "text1 text2: -1.2345 23.5 -234.56731"
  "text154 text2: 5.23 -2.987 -2.531"
  and I would like to read the fourth string from each line (in this case: 23.5 and -2.987).

  Best Regards
  Anna

  ************************************************************************
   Anna Modzelewska, M.Sc. amodzelewska_at_iimcb.gov.pl
   International Institute of Molecular and Cell Biology
   http://www.iimcb.gov.pl/
   Trojdena 4, 02-109 Warsaw, Poland
   phone: +48 22 5970721 fax: +48 22 5970715
  ************************************************************************

----------------------------------------------------------------------------

    avast! Antivirus: Inbound message clean.

    Virus Database (VPS): 0606-4, 10-02-2006
    Tested on: 13-02-2006 14:02:34
    avast! - copyright (c) 1988-2005 ALWIL Software.
     

---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0606-4, 10-02-2006
Tested on: 13-02-2006 14:10:27
avast! - copyright (c) 1988-2005 ALWIL Software.
http://www.avast.com