![]() |
![]() |
#1 |
Dec 2011
After milion nines:)
56D16 Posts |
![]()
Hi to all
I made small sh script for searching primes inside RES file echo "**** PRIMES FOUND ****" echo " " grep -h 'is prime!' /pepi/p*/lresu0000.txt | cut -d! -f1 echo " " and if I in lresu0000.txt have output as 92*10^5573-1 is prime! (5575 decimal digits, P = 4) Time : 413.977 ms. as result I got 92*10^5573-1 is prime but I wont to get 92*10^5573-1 is prime! ( yes I wont ! mark) So where is problem If I use cut -d( - got syntax error ( ( is not expected) What I write wrong? Thanks Last fiddled with by pepi37 on 2015-04-23 at 22:05 |
![]() |
![]() |
![]() |
#2 |
"/X\(‘-‘)/X\"
Jan 2013
24·3·61 Posts |
![]()
You could easily add it back with sed:
grep -h 'is prime!' /pepi/p*/lresu0000.txt | cut -d! -f1 | sed 's/$/!/' |
![]() |
![]() |
![]() |
#3 |
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
3×29×83 Posts |
![]()
Put the ( in quotes. It's a special shell character, so sh isn't interpreting it as a simple argument to cut. Quoting it tells the shell you just want a literal (
|
![]() |
![]() |
![]() |
#4 |
Dec 2011
After milion nines:)
101011011012 Posts |
![]()
grep -h 'is prime!' /pepi/p*/lresu0000.txt | cut -d! -f1 | sed 's/$/!/'
Put the ( in quotes. It's a special shell character, so sh isn't interpreting it as a simple argument to cut. Quoting it tells the shell you just want a literal ( Both works perfect! WOW so many answers in two minutes Thanks to all! Last fiddled with by pepi37 on 2015-04-23 at 22:04 |
![]() |
![]() |
![]() |
#5 |
Sep 2002
Database er0rr
2×5×353 Posts |
![]() Code:
cut -d\ -f1,3 ![]() |
![]() |
![]() |
![]() |
#6 |
Dec 2011
After milion nines:)
3·463 Posts |
![]() |
![]() |
![]() |
![]() |
#7 |
Dec 2011
After milion nines:)
101011011012 Posts |
![]()
I will write in this topic ( to make forum clean)
I have four dir named p1 p2 p3 p4 Inside every dir is file called lresults.txt I wont to make small sh script to copy content of all lresults.txt in one big file called results.txt outside those dir and after that deleting all lresults.txt inside all dir.. |
![]() |
![]() |
![]() |
#8 | |
"Ed Hall"
Dec 2009
Adirondack Mtns
67218 Posts |
![]() Quote:
Code:
cat p*/lresults.txt > results.txt rm p*/lresults.txt |
|
![]() |
![]() |
![]() |
#9 |
Dec 2011
After milion nines:)
3×463 Posts |
![]()
EDH, works perfect!
Thanks! And if I wont to delete content of lresults.txt but not lresults.txt itself, what to change? found solution for fname in /pepi/p*/lresults.txt do > $fname done :) Last fiddled with by pepi37 on 2015-05-15 at 15:13 Reason: add more info |
![]() |
![]() |
![]() |
#10 | |
"Mike"
Aug 2002
794110 Posts |
![]() Quote:
Code:
cat p*/lresults.txt > results.txt && rm p*/lresults.txt A simple example that illustrates this concept: Code:
$ whoami m $ cd / $ touch a && ls touch: cannot touch ‘a’: Permission denied touch a; ls touch: cannot touch ‘a’: Permission denied bin boot dev etc home initrd.img lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var vmlinuz |
|
![]() |
![]() |
![]() |
#11 |
"Mike"
Aug 2002
3×2,647 Posts |
![]() |
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sieving with powers of small primes in the Small Prime variation of the Quadratic Sieve | mickfrancis | Factoring | 2 | 2016-05-06 08:13 |
Small primes | kar_bon | Riesel Prime Data Collecting (k*2^n-1) | 3 | 2013-05-11 04:56 |
Small Primes | Housemouse | Math | 2 | 2008-06-04 05:23 |
Small Primes for Octoproths <= 155 | ValerieVonck | Octoproth Search | 100 | 2007-02-16 23:43 |
Generating Small Primes | wblipp | Software | 2 | 2005-01-05 13:29 |