convert month from Aaa to xx in little script with awk

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

    To parse AIX istat, I use:

    istat .profile | grep "^Last modified" | read dummy dummy dummy  mon day time dummy yr dummy
    echo "M: $mon D: $day T: $time Y: $yr"
    -> Month: Mar Day: 12 Time: 12:05:36 Year: 2012
    

    To parse AIX istat month, I use this two-liner AIX 6.1 ksh 88:

    monstr="???JanFebMarAprMayJunJulAugSepOctNovDec???"
    mon="Oct" ; hugo=${monstr%${mon}*} ; hugolen=${#hugo} ; let hugol=hugolen/3 ; echo "Month: $hugol"
    -> Month: 10
    

    1..12 : month name ok

    If lt 1 or gt 12 : month name not ok

    Instead of "hugo" use speaking names ;-))

提交回复
热议问题