mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Linux (https://www.mersenneforum.org/forumdisplay.php?f=39)
-   -   Searching data from npg files ( Primegrid) (https://www.mersenneforum.org/showthread.php?t=21041)

pepi37 2016-02-27 23:58

Searching data from npg files ( Primegrid)
 
I do search
awk /40...../ t17_b2_k??.npg >ex.txt
awk /40...../ t17_b2_k1??.npg >>ex.txt
[COLOR=Blue]awk /40...../ t17_b2_k4??.npg >>ex.txt[/COLOR]
sort -n -k2,2 -k1,1 ex.txt > EXSORT4.txt
rm ex.txt
and result I got
...
21 4099999
31 4099999
181 4099999
[COLOR=Red]405 4100001
401 4100002[/COLOR]
...
[COLOR=Red]409 4999985
407 4999994[/COLOR]

So why is my search limit "broken" but only for K from 400 - 410?

unconnected 2016-02-28 00:36

Include space to the search pattern:
awk /\ 40...../ t17_b2_k??.npg

I use this construction for cut ranges from the .npg files:
awk '{if (($2>4000000) && ($2<4100000)) print $0}' 5.npg

pepi37 2016-02-28 01:04

Thanks!
Works perfectly well :)

Batalov 2016-02-28 02:45

[QUOTE=unconnected;427643]I use this construction for cut ranges from the .npg files:
awk '{if (($2>4000000) && ($2<4100000)) print $0}' 5.npg[/QUOTE]
awk is a good tool to use for many operations with npg files.
Especially when you are dealing with wide ranges of values (over one power of magnitude; grep patterns are still possible but ugly).
Yet another way for capturing a range like this is 'int($2/100000)==40'

All of these are equivalent (note that is you are only [B]print[/B]'ing then [B]awk 'condition'[/B] is equivalent to [B]awk '{if(condition){print}}' [/B]):
[CODE]awk '{if (($2>=4000000) && ($2<4100000)) print $0}' 5.npg
awk '$2>=4000000 && $2<4100000' 5.npg
awk 'int($2/100000)==40' 5.npg

# Unrelated; here is a simple trick to find squares in the first column
awk 'int(sqrt($1+0.1))**2==$1' 5.npg
# here +0.1 is to avoid rare sqrt return values like 719.9999, costs nothing[/CODE]

pepi37 2016-06-29 07:24

My next problem is

in npg file I have data

21 4099999
31 4099999
181 4099999

I now know how to extract needed data from npeg file, but I wont next step
when data is extracted, then, new ( same file) is created, and extracted data is removed

example.: from above data, 31 4099999 is removed, and now npeg file contain only
21 4099999, and 181 4099999

It is easy to manually remove one or two data lines, but when you do on large scale... is it bit hard to do manually

henryzz 2016-06-29 11:11

It is possible to fiddle this sort of thing by using srfile. Assuming that the npg file is of a form supported by srfile then you can just get it to output it in npg format with -g which will be a file for each k. You can then recombine them after deleting the unwanted ks by outputting in prp format which is what you are in currently(combined npg files).

Looking back at the question this might not answer it. If necessary you can change the header to an abc header and trick it to do lots of things.


All times are UTC. The time now is 19:25.

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