![]() |
![]() |
#1 |
Apr 2011
26 Posts |
![]()
Is there a way to have APRCL output to file without all the verbosity?
I'm using yafu-Win32.exe "aprcl(@)" -batchfile in.bat > outfile.txt on the command line and it works fine. But when you have an outfile with thousands of results in it it is impractical to go through it manually trying to pull out the primes. I know I can use factor with the batchfile and use the -op flag to get no verbosity at all but it takes factor a lot longer. Eg, I have a 1.19Mb in.bat file. Using APRCL took 15 minutes to test all the numbers. Using factor took 47 minutes. And these were small numbers (19 digits long each). They only get bigger from here. If worse comes to worse I can use Excel or Word and write some VB code to go through the outfile and pull out the primes but I'm trying to avoid that. So how do I get APRCL to output ONLY the prime numbers themselves? TIA |
![]() |
![]() |
![]() |
#2 |
Bamboozled!
"πΊππ·π·π"
May 2003
Down not across
244128 Posts |
![]()
grep
Last fiddled with by xilman on 2019-04-20 at 18:17 |
![]() |
![]() |
![]() |
#3 |
Apr 2011
1008 Posts |
![]()
Umm, what does grep mean?
|
![]() |
![]() |
![]() |
#4 |
"Rashid Naimi"
Oct 2015
Remote to Here/There
7·283 Posts |
![]()
Regular-Expressions
https://en.m.wikipedia.org/wiki/Regular_expression https://en.m.wikipedia.org/wiki/Grep You can also use JavaScript which has powerful pattern-matching capabilities and use your browser as the engine. Personally, I use a combination of notepad and Microsoft word for tasks like this. It's not worth the time to write the code to perform the pattern matching if you know how to manipulate the find and replace features of Microsoft word which can also do pattern-matching. Last fiddled with by a1call on 2019-04-20 at 19:48 |
![]() |
![]() |
![]() |
#5 |
"Ed Hall"
Dec 2009
Adirondack Mtns
67268 Posts |
![]()
I don't know how to use grep with Windows, but an example using linux:
in.bat: Code:
791983480490047827611713671673243269719475033357020491318658587370734859917501757247280274120687620244932823203078126584367941327107909441393420761629669182060309428959781205938878991287988842504651654418555273833187612069989016960300232281081564383945219330853192499288775093985688277416598739633747 Code:
$ ./yafu "aprcl(@)" -batchfile ./in.bat | grep "Input is prime" Code:
Input is prime. P300 Code:
$ ./yafu "aprcl(@)" -batchfile ./in.bat | grep "Input is prime" | >outfile.txt |
![]() |
![]() |
![]() |
#6 | |
If I May
"Chris Halsall"
Sep 2002
Barbados
100100101110102 Posts |
![]() Quote:
My students and employees tend to hate me. I'm OK with that. |
|
![]() |
![]() |
![]() |
#7 |
Apr 2011
26 Posts |
![]()
Ah, I see. Thanks for the info. I'll see how it works.
|
![]() |
![]() |
![]() |
#8 |
Apr 2011
4016 Posts |
![]()
Well, I tried it but it tells me 'The syntax of the command is incorrect.' I'm using yafu-1.34 in Windows XP. I tried taking the pipes out and thought it worked but looking in outfile all it said was 'no switch detected'.
|
![]() |
![]() |
![]() |
#9 | |
"Ben"
Feb 2007
3,361 Posts |
![]() Quote:
I think something like this would be equivalent to EdH's command: .\yafu-Win32.exe "aprcl(@)" -batchfile in.bat | findstr /c:"Input is prime" > outfile.txt Last fiddled with by bsquared on 2019-04-21 at 15:06 |
|
![]() |
![]() |
![]() |
#10 |
Sep 2009
36748 Posts |
![]()
Or just use grep etc to search the output file:
Code:
grep prime outfile.txt Having run yafu you can quickly try grep with various parms until you have the output you want. Chris |
![]() |
![]() |
![]() |
#11 |
Apr 2011
26 Posts |
![]()
Yes, this does indeed work. Thanks. It prints 'Input is prime. P19' to file. It also prints 'Input is composite. C19' to file. Now to modify it so it prints just the actual number. After all, a file full of hundreds of thousands of lines of 'Input is prime/composite. P/C19' doesn't really do any good. :)
|
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
APRCL implementations comparison | ldesnogu | Computer Science & Computational Number Theory | 11 | 2015-10-28 12:54 |
Yafu flags on windows | yavanna87 | YAFU | 4 | 2011-11-09 06:02 |
msieve_obj_new and flags | davidknippers | Msieve | 2 | 2011-10-27 11:44 |