To get the frequency of objects in a certain column of a file, I created a small Bash script.
The output will be done this way
A30b 25c20d15e10
I used inside the script Here's the order
cut -f $ 1 $ 2 | Sort | UNIK-C | Sort-r -k1,1 -n | How can I modify it to show relative percentages for each case? "------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ----------------------------------------- So it will A 30 30% B 25 25% C 20 20% D 15 15% E 10 10%
Try it (moved to the end of type:
cut -f $ 1 $ 2 | sort | unique -c | awk '{array [$ 2] Printf "% -20s% -15d% 6.2f %% \ n", i, array [i], array [i] / zodiac * for array = = 1 = $ 1; amount + = $ 1} END { 100} '| sort -r -k2,2 -n] < / Code>
Comments
Post a Comment