MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: trying to pull numbers out of a string from a file...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36621] Re: [mg36595] trying to pull numbers out of a string from a file...
  • From: Tomas Garza <tgarza01 at prodigy.net.mx>
  • Date: Fri, 13 Sep 2002 23:33:28 -0400 (EDT)
  • References: <200209130514.BAA17465@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Could you send a sample example of your file -- just a few records.

Tomas Garza
Mexico City
----- Original Message -----
From: "1.156" <rob at piovere.com>
To: mathgroup at smc.vnet.net
Subject: [mg36621] [mg36595] trying to pull numbers out of a string from a file...


> I've got to extract some numbers from a file that are in lines of text.
Since the line contents are not numbers, I presume I must pull the line out
as a string.  Here I start by pulling out just one line:
>
> inFile = OpenRead["197-tst.txt"]
> y = ReadList[inFile, String, 1, RecordLists -> True]
> Close[inFile];
>
> This appears to pull in a line. Now I want to take characters 25 to 110 to
get just the stuff I want:
> y1=StringTake[y ,{25,110}];
>
> Here's the output.  StringTake doesn't seem to work.
>
> StringTake[{aEX-004   2002197 0 0 0 5935.80 5946.66  27.06 -1281.9   -229.
321.    317.    367.   -115.    126.    146.   -410.  -426.000000EF   75.},
{25, 110}]
>
> It doesn't take loading another package as far
> as I can tell from the help.  I'm thinking that it doesn't work because
it's trying to work on a list
> rather than a string. I've tried Flatten, and other stuff to try to get to
just a string and not a list but
> nothing has worked so far.  I'm a long way from getting to those numbers
in there but heck, I
> can't even get to the string.  Can anyone point me in the right direction?
>
> Thanks, Rob
>
>
>




  • Prev by Date: Checking Programming errors; a ?
  • Next by Date: RE: trying to pull numbers out of a string from a file.
  • Previous by thread: trying to pull numbers out of a string from a file...
  • Next by thread: Re:trying to pull numbers out of a string from a file...