Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I have a multi-line file with questionably random number on most of the lines. All other lines are empty. I'm trying to see if there is a pattern in the occurence of these numbers. I imagine I would use something like grep, but I'm not sure, and I want to do this effectively.
Basically I got bored and decided to see if there are any interesting patterns in the occurrences Prime Numbers. Off hand, I can see that most of the numbers of non-primes between each prime is also a prime number. Also these numbers, when finding primes <= 200,000, tend to be small (rarely over 30). Also, primes have a tendency to group in pairs with one non-prime between them. Here is what the first few lines of my file look like (line numbers on the left, number of non-primes between each prime on the right):
In general, you need to methodically take existing patterns and then look for repeats. This will be CPU-intensive.
There are likely many sites full of algorithms for doing this kind of thing. LQ is not one of them.....
The file is multi-lined. Each line will either have a number or nothing at all. The corresponding line number of those lines with a number represents a prime number. The number indicates the number of non-primes between this prime, and the last.
Well, you know what they say: a week in the lab will save you an hour in the library. I already know about grep, sed, and awk (gawk), I was just wondering if you guys knew of any neat ways of combining them (or other commands) to discover patterns, but I'll take that as a no. Well, from the looks of it, I'll just have to create a custom pattern recognizer.