![]() |
|
|
#1 | |||||||
|
Dec 2011
After milion nines:)
5×172 Posts |
results.txt
--------------------------------------------------------------------------- [Sat Jul 11 23:04:00 2015] 2*11^13355+1 is not prime. RES64: 2BC6AF8D47953C43. We8: 68566856,00000000 2*11^13356+1 is not prime. RES64: 27FF3175F85CE71C. We8: 68586858,00000000 2*11^13357+1 is not prime. RES64: 0FE8C886B553D211. We8: 685A685A,00000000 2*11^13359+1 is a probable prime! We8: 685E685E,00000000 --------------------------------------------------------------------------- clear echo echo " **** UP TIME **** " echo " " Quote:
echo " " echo " **** PRP FOUND **** " echo " " Quote:
grep -h 'prime!' /pepi/res.txt | cut -d"W" -f1 grep -h 'prime!' /pepi/prp.txt | cut -d"W" -f1 echo " " echo "COLLECTING RESULTS" cat /pepi/mprime/results.txt >> res.txt for fname in /pepi/mprime/results.txt Quote:
> $fname done echo "COLLECTING DONE " echo " " grep -h 'prime.' /pepi/res.txt | cut -d"W" -f1 > res.txt Quote:
Quote:
Quote:
echo NUMBER of PRIMES wc -l prp.txt | cut -d "p" -f1 Quote:
exit What I do wrong? This is my script that collects results from file, remove part of lines, and wrote that in res.txt and prp.txt And all is ok if there is data in "initial file"- results.txt, this script do exactly what I wont But if results.txt is empty, then script also delete content of res.txt? Why, where is error? Thanks for any advice! Last fiddled with by pepi37 on 2015-07-12 at 00:57 |
|||||||
|
|
|
|
|
#2 |
|
"/X\(‘-‘)/X\"
Jan 2013
22·733 Posts |
Code:
grep -h 'prime.' /pepi/res.txt | cut -d"W" -f1 > res.txt You could test if the file is empty at the beginning and exit or whatever: Code:
if [[ ! -s /pepi/res.txt ]] ; then exit ; fi |
|
|
|
|
|
#3 |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
1C3516 Posts |
Or use ">>" (appends without overwriting)
|
|
|
|
|
|
#4 | |
|
Dec 2011
After milion nines:)
5A516 Posts |
If I do that then number of lines id doubled in every checking, so that is not solution.
But I dont know why is doubling if initial file is empty. Quote:
Last fiddled with by pepi37 on 2015-07-12 at 08:10 |
|
|
|
|
|
|
#5 |
|
Dec 2011
After milion nines:)
101101001012 Posts |
I found where error was.
I must create temporary file and then delete it grep -h 'prime.' /pepi/resu.txt | cut -d"W" -f1 >> results.txt rm resu.txt Now all is perfect! Thanks for help! |
|
|
|
![]() |
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Is Moore's Law wrong, or is it wrong-headed (6th time around) | jasong | jasong | 12 | 2016-05-27 11:01 |
| Am I doing it wrong? | kracker | PrimeNet | 3 | 2012-07-01 22:35 |
| something wrong with my RAM? | ixfd64 | Hardware | 13 | 2010-07-17 20:49 |
| Something is very wrong... | RhymeBomb | Information & Answers | 7 | 2010-02-28 09:53 |
| something wrong here? | ixfd64 | Lounge | 2 | 2007-09-17 13:20 |