Link to home
Start Free TrialLog in
Avatar of Europa MacDonald
Europa MacDonaldFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Selecting out rows of numbers

I have attached a list of 2047 results for an american lottery. draw-results-1-to-2047.txt

I need to strip out only the lines with the actual draw results and do away with all the other data as per this sample file embed=file 1182640]

I know very little about PERL.
EE-sample-file.txt
Avatar of Bill Prew
Bill Prew

Not sure how you are using Perl, but I suspect you could use one of the following regex strings to select these lines.  The first just matches the lines you want.  The second makes each of the 6 numbers a token that you could then reference in the Perl logic.

^[0-9]+\s+[0-9]+\s+[0-9]+\s+[0-9]+\s+[0-9]+\s+[0-9]+$

^([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)$

Open in new window


»bp
Avatar of Europa MacDonald

ASKER

THanks Bill. I am using PERL from the command line, so if you could give me some code to parse out the required Rows and write them to a text file, thatd be great :)
If you are just trying to select the desired lines, why not just use grep?


»bp
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Bill worked great