Computing.Net > Forums > Programming > For and extracting nums from text

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

For and extracting nums from text

Reply to Message Icon

Name: stroke6463
Date: November 4, 2004 at 15:25:20 Pacific
OS: XP Pro
CPU/Ram: idk
Comment:

Hey everyone I need to know how to extract numbers from a text file. I'm a beginner with the for command and I'm not sure how to go about this. Basically this is what I have:

I use the findstr command and get the line:
9001001810.110000350

Now I want to get the 350 by itself and the 1001810.11 by itself and be able to echo on the screen "Count: 350" "Average: 1001810.11".

These numbers change every day but the placement is still the same so this needs to work with different numbers also. Could someone please help me? Thanks.




Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: November 4, 2004 at 17:44:26 Pacific
Reply:

Hi Pat,

Get the string into string.txt ; then:

::
@echo off

set /p string=<string.txt

echo Average: %string:~3,10%
::

HTH


M2


0

Response Number 2
Name: stroke6463
Date: November 5, 2004 at 13:20:13 Pacific
Reply:

Thanks a lot that works great.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: For and extracting nums from text

extracting text from *.pdf files www.computing.net/answers/programming/extracting-text-from-pdf-files/20250.html

Extracting rows from pipe delimited file www.computing.net/answers/programming/extracting-rows-from-pipe-delimited-file/19338.html

Extracting data from an array in C www.computing.net/answers/programming/extracting-data-from-an-array-in-c/8130.html