convert month from Aaa to xx in little script with awk

后端 未结 4 440
执笔经年
执笔经年 2021-01-14 01:27

I am trying to report on the number of files created on each date. I can do that with this little one liner:

ls -la foo*.bar|awk \'{print $7, $6}\'|sort|uni         


        
4条回答
  •  终归单人心
    2021-01-14 02:04

    Assuming the name of the months only appear in the month column, then you could do this:

    ls -la foo*.bar|awk '{sub(/Jan/,"01");sub(/Feb/,"02");print $7, $6}'|sort|uniq -c
    

提交回复
热议问题