mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Programming

Reply
 
Thread Tools
Old 2003-10-13, 14:14   #1
GP2
 
GP2's Avatar
 
Sep 2003

5×11×47 Posts
Default Perl scripts to convert status.txt and cleared.txt into comma-separated form

The files status.txt and cleared.txt are available at:
http://www.mersenne.org/primenet/status.txt
http://www.mersenne.org/primenet/cleared.txt

These files are in a fixed-width format that is not necessarily convenient for data manipulation, and include a lot of non-data lines (header, footer, column headings).

The following converts the files first into the comma-separated files:
status_comma.txt
cleared_comma.txt

Then the files are further split into:
status_f.txt
status_l.txt
cleared_f.txt
cleared_l.txt
(with _f for factoring and and _l for LL assignments),
at which point status_comma.txt and cleared_comma.txt can be discarded.

Code:
    perl statusizer.pl status.txt > status_comma.txt
    perl -n -e 'print if /^[^,]*,.F,/' status_comma.txt > status_f.txt
    perl -n -e 'print unless /^[^,]*,.F,/' status_comma.txt > status_l.txt

    perl clearedizer.pl cleared.txt > cleared_comma.txt
    perl -n -e 'print if /^([^,]*,){2}.F,/' cleared_comma.txt > cleared_f.txt
    perl -n -e 'print unless /^([^,]*,){2}.F,/' cleared_comma.txt > cleared_l.txt
Perl is used because it is available on both Linux and Windows.

The scripts statusizer.pl and clearedizer.pl are attached.
Attached Files
File Type: zip sc_comma.zip (1.8 KB, 210 views)
GP2 is offline   Reply With Quote
Old 2003-10-13, 15:48   #2
dsouza123
 
dsouza123's Avatar
 
Sep 2002

2·331 Posts
Default

If you are using windows what brand and version of perl do you use ( or if not using windows what do you recommend ) ?

Thanks for the scripts.
dsouza123 is offline   Reply With Quote
Old 2003-10-13, 16:27   #3
GP2
 
GP2's Avatar
 
Sep 2003

5·11·47 Posts
Default

Quote:
Originally posted by dsouza123
If you are using windows what brand and version of perl do you use ( or if not using windows what do you recommend ) ?

Thanks for the scripts.
Well actually I use Linux.

For Windows I think you can get ActiveState's version of Perl, but I've never personally used it.
GP2 is offline   Reply With Quote
Old 2003-10-13, 17:17   #4
Xyzzy
 
Xyzzy's Avatar
 
Aug 2002

8,311 Posts
Default

If you are running Windows, and you don't have Cygwin installed, then shame on you...

http://www.cygwin.com/
Xyzzy is offline   Reply With Quote
Old 2003-10-13, 18:12   #5
GP2
 
GP2's Avatar
 
Sep 2003

1010000110012 Posts
Default

Quote:
Originally posted by Xyzzy
http://www.cygwin.com/
Yes, perhaps Cygwin might be the best alternative.

All of my scripts for datamining the data files use standard Linux utilities like sort, uniq, cut, comm, join, paste and also sed, grep, perl. With Cygwin these become available on Windows too.
GP2 is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Scripts thread bsquared YAFU 4 2012-10-21 19:45
the scripts thread Mini-Geek Conjectures 'R Us 52 2012-05-29 21:43
Perl scripts for result file conversion nuggetprime No Prime Left Behind 5 2009-01-02 19:44
convert 3d into 2d nuggetprime Programming 6 2007-09-22 08:35
Linux! Convert me! OmbooHankvald Linux 8 2005-08-13 23:50

All times are UTC. The time now is 23:12.


Sun Oct 24 23:12:59 UTC 2021 up 93 days, 17:41, 0 users, load averages: 1.62, 1.21, 1.23

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.