Hello all,
I'm still sort of a beginner at bash scripting and need help with the following.
I have a set of commands that will output a list of values. The exact values, and number thereof, is not set and can and will vary each time I run the command.
What I want to do is to insert the output of this commando into an array, and them compare how many instances of each digit is present. If one digit appears more times then rest I want to print text to standard output.
An example.
cat ./hba.txt | grep '.:.:.:.' | awk -F: '{print $1}' | cut -c4-5
returns the following list:
Quote:
0
0
2
2
0
0
[..]
3
3
1
1
3
3
1
1
|
What I want to do is count how many times 0 appears, how many times 1 appears and how many times 2 and so on. I then want to compare these values and if one of these numbers appear more than the rest, I want to echo something.
With sort | uniq -c I added on to the end of the first line I can see that 0 appears twelve times, 1 eight times, 2 twelve times and 3 eight times:
So, what I really need help with is finding a way to compare them!
Thanks in advance.