convert month from Aaa to xx in little script with awk

后端 未结 4 436
执笔经年
执笔经年 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:03

    Just use the field number of your month as an index into the months array.

    print months[$6]
    

    Since ls output differs from system to system and sometimes on the same system depending on file age and you didn't give any examples, I have no way of knowing how to guide you further.

    Oh, and don't parse ls.

提交回复
热议问题