Jump to content

Pulling info from text file


Recommended Posts

I have several large text files that I am trying to pull certain information together so that it can be imported into another application. I've attached a small excerpt from one of the files to show what I'm trying to work with.

The output should be a text file that basically looks like:

8: 331086

9: 10457

10:

11: 32993

12: 111161

14:

15:

16: 18335

17:

18: 79525

19: 264366

I've used pdftotext to dump a PDF to the text file maintaining the format, otherwise everything is so out of order. I know how to open the file, read each line, and write it to another file. What I can't figure out is how to parse each line for the desired information. Some of the lines contain numbers that I don't need and I thought maybe a regular expression would work but I really don't understand using regular expressions.

tax1.txt

Link to comment
Share on other sites

You might be able to use this pattern on every line to get you the last 2 group of numbers:

#include <Array.au3>
$str = "16        Advertising ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                    16                      18335."
$tt = StringRegExp($str, "(\d+\h+\d+\.)\z", 1)
_ArrayDisplay($tt)

It would be up to you to process this further.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...