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"
m |
(Offload choice of file count to script call instead of editing the file.) |
||
Line 13: | Line 13: | ||
*create a file named <code>split.awk</code> with this code: | *create a file named <code>split.awk</code> with this code: | ||
<pre> | <pre> | ||
− | BEGIN{getline line; i=1} | + | BEGIN {getline line; i=1} |
− | + | { | |
− | {print line >>i". | + | if (head[i] == 0) |
+ | { | ||
+ | print line >>i".txt" | ||
head[i]=1 | head[i]=1 | ||
} | } | ||
− | print $0 >>i". | + | print $0 >>i".txt" |
i++ | i++ | ||
− | if (i== | + | if (i==files+1) i=1 |
− | + | } | |
</pre> | </pre> | ||
*copy the sieve file in this folder (for example <code>t16_b999.prp</code> | *copy the sieve file in this folder (for example <code>t16_b999.prp</code> | ||
− | *calling <code>gawk -f split.awk t16_b999.prp</code> | + | *calling <code>gawk -f split.awk files=4 t16_b999.prp</code> |
Results: | Results: | ||
*creates 4 files <code>1.pfgw</code> to <code>4.pfgw</code> with equally splitted candidates sorted by n | *creates 4 files <code>1.pfgw</code> to <code>4.pfgw</code> with equally splitted candidates sorted by n | ||
[[Category:Code snippets]] | [[Category:Code snippets]] |
Revision as of 18:46, 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
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
- calling
gawk -f split.awk files=4 t16_b999.prp
Results:
- creates 4 files
1.pfgw
to4.pfgw
with equally splitted candidates sorted by n