Skip to content

Instantly share code, notes, and snippets.

@akanehara
Last active June 29, 2016 01:48
Show Gist options
  • Save akanehara/2804468251c6d8a00337be48cf5e3116 to your computer and use it in GitHub Desktop.
Save akanehara/2804468251c6d8a00337be48cf5e3116 to your computer and use it in GitHub Desktop.
Redmine作業時間ユーティリティ(OS X | BSD)
nkf timelog.csv | awk -v Date="2016/05/23" -F',' 'BEGIN{OFS="\t"}$2==Date{print$1,$4,$5,$6;d=$2;h+=$7;l++}END{;print l" Rows";print h"[h]",h/8"[day/man]";print d}' | tail -r | tee >(tail -n+4 | pbcopy)
pbpaste | sed -E -e $'s/^[\t\s]*//' | awk -F'\t' '$2~/[0-9]{4}\/[0-9]{2}\/[0-9]{2}/' | awk -F'\t' '{k=$2;gsub(/\//,"",k);d[k]=$2;r[k]=r[k]$1"\t"$4"\t"$5"\t"$6"\n";h[k]+=$7;l[k]++}END{OFS="\t";for(k in d){print d[k],h[k]"[h]",h[k]/8"[day/man]",l[k]" Rows";print r[k]}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment