Hey guys,
I have this script that does count one year of files, 2014, but when it comes to this year, everything messes up.
How could I count properly for each year in the same script ?
In the attached screenshot it's obvious that I would only need 2014 - all of the months and from 2015 only January, but .... how ?
Thanks in advance!
ls -la |
awk -v year="$(date "+%Y")" 'BEGIN {
split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec", month, " ")
for (i=1; i<=12; i++){
mdigit[month[i]]=i
}
}
!/^-/{next}
$8 ~ /:/{$8=year} {
dat=$8 sprintf("%02d",mdigit[$6]) sprintf("%02d",$7)
a[dat]++
}
END{for(i in a){print i, a[i]|"sort"}}'