I am trying to do a count of files by date. The date is a field in the file name itself e.g.
CTCA~AT2~FVT~8388358~ONTAFT2-1~8~P~1100~HR24-500~033189784938~20120224~220306.VER
This is what I did:
find . -name '*VER' |awk -F~ '{print $11}'|uniq -c
This is the output I get:
1 20120222
3 20120222
3 20120224
3 20120224
3 20120225
5 20120225
But I want to sum up the counts like so
4 20120222
6 20120224
8 20120225
How can I do that?
/————————————–/
A simple search with
find . -name '*VER'
returns
...
./CTCA~AT2~FVT~8388358~ONTAFT2-1~7~P~1100~HR24-200~035699170847~20120217~150754.VER
./CTCA~AT2~FVT~8388358~ONTAFT2-1~8~P~1100~HR24-500~033066015695~20120223~204125.VER
./CTCA~AT2~FVT~7561825~ONTAFT2-1~4~P~1100~HR24-100~035688466560~20120223~085805.VER
./CTCA~AT2~FVT~9078749~ONTAFT2-1~4~P~1100~HR24-200~035580595029~20120209~110625.VER
./CTCA~AT2~FVT~7561825~ONTAFT2-1~5~P~1100~HR22-100~028933090384~20120223~104932.VER
...
That’s exactly what
uniq -cshould do. If it isn’t working it’s because your input isn’t sorted. Try this: