search

Home  >  Q&A  >  body text

shell - How does git count submissions during a specified time period every day?

For example: Statistics of submission records after 21:00 and before 5:00 am every day.
After consulting various documents and google, I used the stupidest method to achieve it:

git log --pretty=format:'%h %cn %cd %s' --date='format:%Y-%m-%d %H:%M:%S' | \
awk '{hour=0+substr(,0,2); if(hour>21 || hour<5) printf "%-10s %-15s %-12s %-10s %-10s\n", , , , ,  }'

But it doesn’t look elegant enough. I want to use date comparison in awk, but there are all kinds of pitfalls.
Is there a better way?

淡淡烟草味淡淡烟草味2849 days ago625

reply all(2)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-02 09:36:25

    Why you must use shell+awk

    php and python not working

    reply
    0
  • 高洛峰

    高洛峰2017-05-02 09:36:25

    Can use python

    reply
    0
  • Cancelreply