Currently there may be errors shown on top of a page, because of a missing Wiki update (PHP version and extension DPL3). |
Navigation
Topics | Help • Register • News • History • How to • Sequences statistics • Template prototypes |
Difference between revisions of "Splitting a sieve file"
(Offload choice of file count to script call instead of editing the file.) |
(Extension was changed in last edit; adding Linux instructions) |
||
Line 1: | Line 1: | ||
==Description== | ==Description== | ||
− | Splitting a sieve file in [[PRP-LLR format]] into a number of separate files using [[awk]]. | + | Splitting a sieve file in [[PRP-LLR format]] into a number of separate files using <code>[[wikipedia:AWK|awk]]</code>. |
==Needed software== | ==Needed software== | ||
*ASCII editor | *ASCII editor | ||
− | *awk.exe | + | *<code>awk.exe</code> (included by default on Linux) |
==Example== | ==Example== | ||
Split the sieve file <code>t16_b999.prp</code> into 4 separate files. | Split the sieve file <code>t16_b999.prp</code> into 4 separate files. | ||
− | ==Preparation WIN== | + | ===Preparation WIN=== |
− | * | + | *Copy <code>gawk.exe</code> in a folder |
− | * | + | *Create a file named <code>split.awk</code> with this code: |
<pre> | <pre> | ||
BEGIN {getline line; i=1} | BEGIN {getline line; i=1} | ||
Line 25: | Line 25: | ||
} | } | ||
</pre> | </pre> | ||
− | * | + | *Copy the sieve file in this folder (for example <code>t16_b999.prp</code>). |
− | * | + | *Call <code>gawk -f split.awk files=4 t16_b999.prp</code>. |
Results: | Results: | ||
− | * | + | *Creates 4 files <code>1.txt</code> to <code>4.txt</code> with equally split candidates sorted by {{Vn}}. |
+ | |||
+ | ===Preparation LINUX=== | ||
+ | *<code>awk</code> is probably already present on your computer. | ||
+ | *Create a file named <code>split.awk</code> with the same code as above. | ||
+ | *Copy the sieve file in this folder (for example <code>t16_b999.prp</code>). | ||
+ | *Call <code>awk -f split.awk files=4 t16_b999.prp</code>. | ||
+ | |||
+ | Results: | ||
+ | *Creates 4 files <code>1.txt</code> to <code>4.txt</code> with equally split candidates sorted by {{Vn}}. | ||
+ | |||
[[Category:Code snippets]] | [[Category:Code snippets]] |
Latest revision as of 18:52, 2 October 2022
Description
Splitting a sieve file in PRP-LLR format into a number of separate files using awk
.
Needed software
- ASCII editor
awk.exe
(included by default on Linux)
Example
Split the sieve file t16_b999.prp
into 4 separate files.
Preparation WIN
- Copy
gawk.exe
in a folder - Create a file named
split.awk
with this code:
BEGIN {getline line; i=1} { if (head[i] == 0) { print line >>i".txt" head[i]=1 } print $0 >>i".txt" i++ if (i==files+1) i=1 }
- Copy the sieve file in this folder (for example
t16_b999.prp
). - Call
gawk -f split.awk files=4 t16_b999.prp
.
Results:
- Creates 4 files
1.txt
to4.txt
with equally split candidates sorted by n.
Preparation LINUX
awk
is probably already present on your computer.- Create a file named
split.awk
with the same code as above. - Copy the sieve file in this folder (for example
t16_b999.prp
). - Call
awk -f split.awk files=4 t16_b999.prp
.
Results:
- Creates 4 files
1.txt
to4.txt
with equally split candidates sorted by n.