mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Linux

Reply
 
Thread Tools
Old 2021-10-24, 22:06   #1
pepi37
 
pepi37's Avatar
 
Dec 2011
After milion nines:)

1,487 Posts
Default little help needed

I assume "my problem" can be solved with awk, sed or similar tool.
Please look at http://www.noprimeleftbehind.net/crus/Riesel-conjecture-base35-reserve.htm

Quote:
423 k's remaining at n=100K:

716, 854, 3370, 3974, 5710, 5714, 6046, 7142, 9022, 10936, 11654, 11664, 13484, 13738.....
So, I need to copy above text in input.txt and as output got text file in next format


Quote:
715(100K)
854(100K)
3370(100K)
3974(100K)
5710(100K)
etc
Can somebody write solution for my problem? Thanks
pepi37 is online now   Reply With Quote
Old 2021-10-24, 23:11   #2
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

3×372 Posts
Default

Quote:
Originally Posted by pepi37 View Post
I assume "my problem" can be solved with awk, sed or similar tool.
Please look at http://www.noprimeleftbehind.net/crus/Riesel-conjecture-base35-reserve.htm

Quote:
423 k's remaining at n=100K:

716, 854, 3370, 3974, 5710, 5714, 6046, 7142, 9022, 10936, 11654, 11664, 13484, 13738.....
So, I need to copy above text in input.txt and as output got text file in next format


Quote:
715(100K)
854(100K)
3370(100K)
3974(100K)
5710(100K)
etc
Can somebody write solution for my problem? Thanks
Is this what you need?:
Code:
716(100k)
854(100k)
3370(100k)
3974(100k)
5710(100k)
5714(100k)
6046(100k)
7142(100k)
9022(100k)
10936(100k)
11654(100k)
11664(100k)
13484(100k)
13738(100k)
14576(100k)
14960(100k)
14992(100k)
15722(100k)
15988(100k)
16454(100k)
17114(100k)
17254(100k)
17702(100k)
17812(100k)
18334(100k)
18694(100k)
19004(100k)
20710(100k)
20858(100k)
21034(100k)
21050(100k)
21076(100k)
21596(100k)
21620(100k)
21776(100k)
23642(100k)
23806(100k)
24038(100k)
25234(100k)
25918(100k)
26482(100k)
26692(100k)
27008(100k)
27098(100k)
28232(100k)
31090(100k)
32496(100k)
32566(100k)
32678(100k)
33016(100k)
33710(100k)
33952(100k)
36410(100k)
36506(100k)
36734(100k)
38294(100k)
40108(100k)
40616(100k)
41674(100k)
42940(100k)
43156(100k)
44002(100k)
44396(100k)
44630(100k)
44638(100k)
44840(100k)
45488(100k)
46346(100k)
48038(100k)
48290(100k)
48868(100k)
49214(100k)
49618(100k)
50566(100k)
50608(100k)
51616(100k)
52802(100k)
53446(100k)
53974(100k)
54224(100k)
54232(100k)
54254(100k)
54284(100k)
54874(100k)
54986(100k)
55312(100k)
56078(100k)
56150(100k)
56156(100k)
57134(100k)
57250(100k)
57628(100k)
60386(100k)
60880(100k)
61948(100k)
62212(100k)
62752(100k)
64048(100k)
65042(100k)
65282(100k)
65510(100k)
65602(100k)
66808(100k)
68446(100k)
69304(100k)
69392(100k)
70082(100k)
70402(100k)
70564(100k)
70886(100k)
73076(100k)
76270(100k)
77626(100k)
77702(100k)
80336(100k)
80414(100k)
80930(100k)
82220(100k)
83518(100k)
83608(100k)
83866(100k)
84880(100k)
89038(100k)
89150(100k)
89254(100k)
89536(100k)
90086(100k)
90338(100k)
90892(100k)
91456(100k)
92852(100k)
93626(100k)
93752(100k)
94210(100k)
95332(100k)
95356(100k)
95636(100k)
96448(100k)
96604(100k)
96710(100k)
96976(100k)
97132(100k)
97466(100k)
97534(100k)
98680(100k)
99674(100k)
101812(100k)
102022(100k)
102254(100k)
103754(100k)
103832(100k)
104422(100k)
104714(100k)
104822(100k)
104846(100k)
106388(100k)
107552(100k)
107810(100k)
108746(100k)
109162(100k)
109190(100k)
109300(100k)
110594(100k)
110642(100k)
110906(100k)
111100(100k)
112160(100k)
112810(100k)
114422(100k)
115726(100k)
116080(100k)
116158(100k)
117214(100k)
117874(100k)
118310(100k)
119336(100k)
120662(100k)
122038(100k)
123110(100k)
123466(100k)
124034(100k)
124990(100k)
125390(100k)
126608(100k)
127760(100k)
127780(100k)
130208(100k)
133022(100k)
133376(100k)
134696(100k)
135164(100k)
136438(100k)
136526(100k)
137138(100k)
138034(100k)
138082(100k)
139268(100k)
141364(100k)
141926(100k)
142402(100k)
142522(100k)
142678(100k)
143894(100k)
144724(100k)
145076(100k)
145256(100k)
145622(100k)
145642(100k)
146708(100k)
146792(100k)
147018(100k)
147150(100k)
148060(100k)
148736(100k)
149668(100k)
150506(100k)
150634(100k)
152278(100k)
152452(100k)
152776(100k)
153344(100k)
154558(100k)
154970(100k)
156080(100k)
156776(100k)
158518(100k)
158876(100k)
159238(100k)
159694(100k)
160024(100k)
160436(100k)
160502(100k)
160772(100k)
162446(100k)
162802(100k)
163058(100k)
163138(100k)
163588(100k)
165772(100k)
165944(100k)
166726(100k)
167098(100k)
167168(100k)
167326(100k)
167714(100k)
169172(100k)
172642(100k)
172778(100k)
173126(100k)
173956(100k)
174344(100k)
176114(100k)
177160(100k)
177446(100k)
178900(100k)
181174(100k)
181936(100k)
182288(100k)
182846(100k)
183322(100k)
184024(100k)
184204(100k)
185212(100k)
185428(100k)
187706(100k)
188668(100k)
189800(100k)
189952(100k)
190004(100k)
190024(100k)
190852(100k)
190994(100k)
191486(100k)
191824(100k)
192304(100k)
192512(100k)
193904(100k)
194210(100k)
194780(100k)
195406(100k)
195710(100k)
196108(100k)
196244(100k)
197434(100k)
197474(100k)
199234(100k)
199574(100k)
199942(100k)
200014(100k)
200300(100k)
200942(100k)
201470(100k)
201512(100k)
202868(100k)
202918(100k)
203212(100k)
203444(100k)
205910(100k)
207268(100k)
207560(100k)
207866(100k)
208088(100k)
209132(100k)
210200(100k)
210362(100k)
210460(100k)
210626(100k)
210922(100k)
212174(100k)
213358(100k)
213472(100k)
213764(100k)
214696(100k)
215858(100k)
216178(100k)
216362(100k)
216946(100k)
217814(100k)
217876(100k)
218000(100k)
220996(100k)
221534(100k)
222844(100k)
224422(100k)
224428(100k)
225850(100k)
226690(100k)
226742(100k)
227792(100k)
228014(100k)
228608(100k)
229012(100k)
229874(100k)
230400(100k)
231136(100k)
231734(100k)
232376(100k)
232532(100k)
233546(100k)
235244(100k)
235262(100k)
235766(100k)
236536(100k)
236848(100k)
237166(100k)
238762(100k)
239132(100k)
239278(100k)
239300(100k)
239942(100k)
240452(100k)
240584(100k)
240754(100k)
241796(100k)
242758(100k)
243946(100k)
245144(100k)
245606(100k)
245794(100k)
245930(100k)
246418(100k)
247256(100k)
247586(100k)
248212(100k)
248240(100k)
248366(100k)
248866(100k)
249448(100k)
249614(100k)
249908(100k)
251000(100k)
251812(100k)
252526(100k)
252980(100k)
253004(100k)
254140(100k)
254278(100k)
254294(100k)
255920(100k)
256496(100k)
256844(100k)
258170(100k)
258664(100k)
260456(100k)
260690(100k)
261332(100k)
261836(100k)
261842(100k)
262934(100k)
263656(100k)
264122(100k)
264166(100k)
264772(100k)
265240(100k)
265484(100k)
266386(100k)
266750(100k)
269564(100k)
269950(100k)
270578(100k)
270704(100k)
271300(100k)
271504(100k)
272314(100k)
272728(100k)
274124(100k)
274258(100k)
274862(100k)
275164(100k)
275612(100k)
275830(100k)
275960(100k)
276266(100k)
276802(100k)
277652(100k)
278092(100k)
278326(100k)
279686(100k)
279784(100k)
280582(100k)
281932(100k)
283960(100k)
287186(100k)
EdH is offline   Reply With Quote
Old 2021-10-24, 23:17   #3
pepi37
 
pepi37's Avatar
 
Dec 2011
After milion nines:)

101110011112 Posts
Default

Yes, that is perfect
pepi37 is online now   Reply With Quote
Old 2021-10-24, 23:52   #4
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

3×372 Posts
Default

Quote:
Originally Posted by pepi37 View Post
Yes, that is perfect
Great! Here's the script I used, in case you wanted that, too:
Code:
#!/bin/bash/

input="716, 854, 3370, 3974, 5710, 5714, 6046, 7142, 9022, 10936, 11654, 11664, 13484, 13738, 14576, 14960, 14992, 15722, 15988, 16454, 17114, 17254, 17702, 17812, 18334, 18694, 19004, 20710, 20858, 21034, 21050, 21076, 21596, 21620, 21776, 23642, 23806, 24038, 25234, 25918, 26482, 26692, 27008, 27098, 28232, 31090, 32496, 32566, 32678, 33016, 33710, 33952, 36410, 36506, 36734, 38294, 40108, 40616, 41674, 42940, 43156, 44002, 44396, 44630, 44638, 44840, 45488, 46346, 48038, 48290, 48868, 49214, 49618, 50566, 50608, 51616, 52802, 53446, 53974, 54224, 54232, 54254, 54284, 54874, 54986, 55312, 56078, 56150, 56156, 57134, 57250, 57628, 60386, 60880, 61948, 62212, 62752, 64048, 65042, 65282, 65510, 65602, 66808, 68446, 69304, 69392, 70082, 70402, 70564, 70886, 73076, 76270, 77626, 77702, 80336, 80414, 80930, 82220, 83518, 83608, 83866, 84880, 89038, 89150, 89254, 89536, 90086, 90338, 90892, 91456, 92852, 93626, 93752, 94210, 95332, 95356, 95636, 96448, 96604, 96710, 96976, 97132, 97466, 97534, 98680, 99674, 101812, 102022, 102254, 103754, 103832, 104422, 104714, 104822, 104846, 106388, 107552, 107810, 108746, 109162, 109190, 109300, 110594, 110642, 110906, 111100, 112160, 112810, 114422, 115726, 116080, 116158, 117214, 117874, 118310, 119336, 120662, 122038, 123110, 123466, 124034, 124990, 125390, 126608, 127760, 127780, 130208, 133022, 133376, 134696, 135164, 136438, 136526, 137138, 138034, 138082, 139268, 141364, 141926, 142402, 142522, 142678, 143894, 144724, 145076, 145256, 145622, 145642, 146708, 146792, 147018, 147150, 148060, 148736, 149668, 150506, 150634, 152278, 152452, 152776, 153344, 154558, 154970, 156080, 156776, 158518, 158876, 159238, 159694, 160024, 160436, 160502, 160772, 162446, 162802, 163058, 163138, 163588, 165772, 165944, 166726, 167098, 167168, 167326, 167714, 169172, 172642, 172778, 173126, 173956, 174344, 176114, 177160, 177446, 178900, 181174, 181936, 182288, 182846, 183322, 184024, 184204, 185212, 185428, 187706, 188668, 189800, 189952, 190004, 190024, 190852, 190994, 191486, 191824, 192304, 192512, 193904, 194210, 194780, 195406, 195710, 196108, 196244, 197434, 197474, 199234, 199574, 199942, 200014, 200300, 200942, 201470, 201512, 202868, 202918, 203212, 203444, 205910, 207268, 207560, 207866, 208088, 209132, 210200, 210362, 210460, 210626, 210922, 212174, 213358, 213472, 213764, 214696, 215858, 216178, 216362, 216946, 217814, 217876, 218000, 220996, 221534, 222844, 224422, 224428, 225850, 226690, 226742, 227792, 228014, 228608, 229012, 229874, 230400, 231136, 231734, 232376, 232532, 233546, 235244, 235262, 235766, 236536, 236848, 237166, 238762, 239132, 239278, 239300, 239942, 240452, 240584, 240754, 241796, 242758, 243946, 245144, 245606, 245794, 245930, 246418, 247256, 247586, 248212, 248240, 248366, 248866, 249448, 249614, 249908, 251000, 251812, 252526, 252980, 253004, 254140, 254278, 254294, 255920, 256496, 256844, 258170, 258664, 260456, 260690, 261332, 261836, 261842, 262934, 263656, 264122, 264166, 264772, 265240, 265484, 266386, 266750, 269564, 269950, 270578, 270704, 271300, 271504, 272314, 272728, 274124, 274258, 274862, 275164, 275612, 275830, 275960, 276266, 276802, 277652, 278092, 278326, 279686, 279784, 280582, 281932, 283960, 287186"
IFS=", "
inputarr=($input)
unset IFS
count=${#inputarr[@]}
tcount=0
echo "count is $count"
while [ $tcount -lt $count ]
  do
    echo "${inputarr[$tcount]}(100k)"
    let tcount=${tcount}+1
  done
EdH is offline   Reply With Quote
Old 2021-10-25, 00:22   #5
Batalov
 
Batalov's Avatar
 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

3·5·641 Posts
Default

or simply
Code:
#!/bin/bash/

input="716, 854, 3370, 3974, 5710, 5714, 6046"
IFS=", "
for i in ${input[@]}
  do echo $i"(100k)"; done
or in awk in one line
Code:
echo "716, 854, 3370, 3974, 5710, 5714, 6046" |awk -F, '{for(i=1;i<=NF;i++){print int($i)"(100k)"}}'
Batalov is offline   Reply With Quote
Old 2021-10-25, 15:21   #6
henryzz
Just call me Henry
 
henryzz's Avatar
 
"David"
Sep 2007
Cambridge (GMT/BST)

3·1,979 Posts
Default

Or in a text editor such as Notepad++ replace ", " with "(100k)\n"
henryzz is offline   Reply With Quote
Old 2021-10-25, 17:18   #7
Batalov
 
Batalov's Avatar
 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

3×5×641 Posts
Default

Quote:
Originally Posted by henryzz View Post
Or in a text editor such as Notepad++ replace ", " with "(100k)\n"
Or let the computer do that:
echo "716, 854, 3370, 3974, 5710, 5714, 6046" |sed 's:, :(100k)\n:g;s:$:(100k):'
Batalov is offline   Reply With Quote
Old 2021-10-26, 01:47   #8
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
"name field"
Jun 2011
Thailand

24×613 Posts
Default

windows, "manual" solution: open your file with notepad++, or programmer's notepad 2, or any editor which is regex aware (in fact, it only need to parse the \n character, doesn't need full regex), open any find/replace dialog (usually ctrl+f), type a comma in the "find" box and type "(100k)\r\n" in the substitution box. Press enter.

It is faster than running some script.
LaurV is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Job needed? LaurV LaurV 11 2019-09-01 02:04
not needed zeit PrimeNet 3 2008-04-25 08:03
Help needed AntonVrba Math 3 2007-03-06 10:55
V24.12 QA help needed Prime95 Software 5 2005-06-17 15:54

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


Wed Dec 1 19:44:41 UTC 2021 up 131 days, 14:13, 1 user, load averages: 1.09, 1.35, 1.43

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.