1

I have a file in the following format:

1043481872
1043481872
1043481872
1043481872
1043481873
1043481873
1043481873
1043481873
1043481874
1043481874
1043481874
1043481875

My question now boils down to a simple graph where the X axis is the unique values in the table and the Y axis would be the number of values of each of them. Eg 1043481874 would be x axis and 3 would be Y axis. If anyone could tell me how to write a bash script to plot this, it would be very helpful

2

Use uniq -c to generate the counts from your file:

4 1043481872
4 1043481873
3 1043481874
1 1043481875

Plot the datapoints with gnuplot; the relevant plot statement in the gnuplot configuration would include

plot … using 2:1

to transpose the X/Y order of the output from uniq.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.