{"id":118,"date":"2018-02-04T07:30:30","date_gmt":"2018-02-03T22:30:30","guid":{"rendered":"http:\/\/www.ofug.net\/hiroki\/?p=118"},"modified":"2018-02-04T07:30:30","modified_gmt":"2018-02-03T22:30:30","slug":"post-118","status":"publish","type":"post","link":"https:\/\/www.ofug.net\/hiroki\/2018\/02\/04\/post-118\/","title":{"rendered":"powershell\u3092\u4f7f\u3046"},"content":{"rendered":"<p>Windows7\u4ee5\u964d\u3067\u306f\u6a19\u6e96\u3067powershell\u304c\u4f7f\u3048\u307e\u3059\u3001\u3068\u3044\u3046\u8a71\u3067\u3059\u3002<\/p>\n<p>\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0(git)\u306e\u30ed\u30b0\u3092\u6574\u5f62\u3057\u305f\u3044\u3053\u3068\u304c\u3042\u308a\u307e\u3057\u305f\u3002<br \/>\n\u30ed\u30b0\u306e\u4e2d\u8eab\u306f\u8907\u6570\u306e\u30b3\u30df\u30c3\u30c8\u306e\u60c5\u5831\u304c\u3042\u308a\u30011\u30b3\u30df\u30c3\u30c8\u306b\u306f\u8907\u6570\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u30ea\u30b9\u30c8\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u3089\u3092\u30d5\u30a1\u30a4\u30eb\u6bce\u306b\u30b3\u30df\u30c3\u30c8\u306e\u60c5\u5831\u3092\u4ed8\u52a0\u3057\u3066\u3001\u51fa\u529b\u3068\u3057\u3066\u306fCSV\u30d5\u30a1\u30a4\u30eb\u306b\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3057\u305f\u3002(\u5f8c\u306fExcel\u3067\u958b\u3044\u3066\u30b4\u30cb\u30e7\u30b4\u30cb\u30e7\u30fb\u30fb\u30fb\u307f\u305f\u3044\u306a\u3002)<br \/>\n\u3067\u3082\u4f7f\u7528\u4e2d\u306eWindows\u30de\u30b7\u30f3\u3067\u3001Linux\u3084FreeBSD\u306e\u3088\u3046\u306a\u3001\u30c6\u30ad\u30b9\u30c8\u51e6\u7406\u3092\u3059\u308b\u74b0\u5883\u3082\u306a\u304f\u3001\u304b\u3068\u3044\u3063\u3066VirutalBox\u3092\u5165\u308c\u308b\u3053\u3068\u3082\u305d\u306e\u6642\u306f\u8003\u3048\u3066\u3044\u306a\u304b\u3063\u305f\u306e\u3067\u3001powershell\u3092\u4f7f\u3046\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u7d50\u8ad6\u304b\u3089\u8a00\u3046\u3068\u3001\u4f7f\u3048\u305f\u306e\u3067\u3059\u304c\u3001bash\u3084Windows\u306e\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u3068\u306f\u3044\u308d\u3044\u308d\u9055\u3046\u3068\u3053\u308d\u304c\u3042\u3063\u3066\u3001\u4f8b\u3048\u3070\u3001<\/p>\n<p>\u30fb\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u66f8\u3044\u3066\u5b9f\u884c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3051\u3069\u3001\u305d\u306e\u305f\u3081\u306b\u306f\u4e88\u3081\u7ba1\u7406\u8005\u6a29\u9650\u3067\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5b9f\u884c\u3092\u8a31\u53ef\u3057\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3002<br \/>\n\u30fb\u30d1\u30a4\u30d7\u51e6\u7406\u304c\u3067\u304d\u308b\u3051\u3069\u3001\u53d7\u3051\u53d6\u308b\u306e\u306f\u6587\u5b57\u5217\u306e\u30b9\u30c8\u30ea\u30fc\u30e0\u3067\u306f\u306a\u304f\u3066\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3002\u30d1\u30a4\u30d7\u51e6\u7406\u306b\u9650\u3089\u305a\u3001\u4f55\u304b\u30b3\u30de\u30f3\u30c9\u30ec\u30c3\u30c8(powershell\u3067\u3044\u3046\u3068\u3053\u308d\u306e\u30b3\u30de\u30f3\u30c9)\u3092\u5b9f\u884c\u3059\u308b\u3068\u7d50\u679c\u306f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u5e30\u3063\u3066\u304f\u308b\u3002<\/p>\n<p>\u3067\u3001\u8272\u3005\u3084\u3063\u305f\u7d50\u679c\u304c\u4e0b\u8a18\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u6587\u5b57\u30b3\u30fc\u30c9\u306e\u6271\u3044\u304c\u3046\u307e\u304f\u3067\u304d\u306a\u304b\u3063\u305f\u306e\u3067\u3001git\u306e\u51fa\u529b\u3092\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8(cmd)\u3067\u53d6\u5f97\u3057\u3066\u3001\u30c6\u30ad\u30b9\u30c8\u30a8\u30c7\u30a3\u30bf(\u3055\u304f\u3089\u30a8\u30c7\u30a3\u30bf)\u3067\u5909\u63db\u3059\u308b\u3001\u3068\u3044\u3046\u3053\u3068\u3092\u3057\u3066\u9003\u3052\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><code><\/p>\n<p># cmd\u3067\u4ee5\u4e0b\u3092\u5b9f\u884c<br \/>\n#<br \/>\n#   git log  --numstat --date=iso &gt; ..\\log.txt<br \/>\n#<br \/>\n# log.txt\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u30c6\u30ad\u30b9\u30c8\u30a8\u30c7\u30a3\u30bf\u3067UTF8\u304b\u3089SJIS\u306b\u5909\u66f4<br \/>\n#<br \/>\n# powershell\u3067\u3001\u3053\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c<br \/>\n#<br \/>\n#   .\\read_git_log2.ps1 log.txt &gt; log.csv<br \/>\n#<br \/>\n# Excel\u3067log.csv\u3092\u958b\u304f<br \/>\n#   \u8ffd\u52a0\u884c\u306e\u96c6\u8a08(\u30b7\u30fc\u30c8log\u304clog.csv\u306e\u5185\u5bb9\u3067\u3001A1\u306b\u30d5\u30a1\u30a4\u30eb\u540d\u3068\u3059\u308b\u3068\u3001)<br \/>\n#   =SUMIFS(log!E:E,log!$D:$D,\"=\" &amp; Sheet1!$A1)<br \/>\n#   \u524a\u9664\u884c\u306e\u96c6\u8a08(\u30b7\u30fc\u30c8log\u304clog.csv\u306e\u5185\u5bb9\u3067\u3001A1\u306b\u30d5\u30a1\u30a4\u30eb\u540d\u3068\u3059\u308b\u3068\u3001)<br \/>\n#   =SUMIFS(log!F:F,log!$D:$D,\"=\" &amp; Sheet1!$A1)<br \/>\n$commit = \"\"<br \/>\n$author = \"\"<br \/>\n$date = \"\"<br \/>\n$comment = \"\"<br \/>\n$file = \"\"<br \/>\n$chgnum = \"\"<br \/>\n$chgline = \"\"<br \/>\n$plusnum = \"\"<br \/>\n$minusnum = \"\"<br \/>\nif ($args.Count -eq 0) {<br \/>\n\"read_git_log2.ps1 logfile\"<br \/>\nreturn<br \/>\n}<br \/>\ncat $args[0]| % {<br \/>\n$line = $_<br \/>\nif ($line -match '^commit.*$') {<br \/>\n$commit = $line -replace '^commit +', ''<br \/>\n$author = \"\"<br \/>\n$date = \"\"<br \/>\n$comment = \"\"<br \/>\n$file = \"\"<br \/>\n$plusnum = \"\"<br \/>\n$minusnum = \"\"<br \/>\n#$commit<br \/>\n} elseif ($line -match '^Author:.*$') {<br \/>\n$author = $line<br \/>\n$author = $author -replace '^Author: +',''<br \/>\n$author = $author -replace '&lt;.+&gt;',''<br \/>\n$author = $author.ToString().Trim()<br \/>\n#$author<br \/>\n} elseif ($line -match '^Date:.*$') {<br \/>\n$date = $line<br \/>\n$date = $date  -replace '^Date: +',''<br \/>\n$date = $date -replace '\\+0900', ''<br \/>\n#$date<br \/>\n} elseif ($line -match '^    .+$') {<br \/>\n$txt = $line -replace '\\W',' '<br \/>\n$comment = \"{0}{1}\" -f $comment, $txt<br \/>\n#\"comment {0}\" -f $comment<br \/>\n} elseif ($line -match '^[0-9-]+\\W+[0-9-]+\\W+.*$') {<br \/>\n$file = $line -replace '^[0-9-]+\\W+[0-9-]+\\W+(.*)$','$1'<br \/>\n$plusnum = $line -replace '^([0-9-]+)\\W+[0-9-]+\\W+.*$','$1'<br \/>\n$minusnum = $line -replace '^[0-9-]+\\W+([0-9-]+)\\W+(.*)$','$1'<br \/>\n\"{0}`t{1}`t{2}`t{3}`t{4}`t{5}`t{6}\" -f $commit, $author, $date, $file, $plusnum, $minusnum, $comment<br \/>\n}<br \/>\n}<\/code><\/p>\n<p>powershell\u306f\u30af\u30bb\u304c\u3042\u3063\u3066\u4f7f\u3044\u3065\u3089\u3044\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u6a19\u6e96\u3067\u5165\u3063\u3066\u3044\u308b\u3053\u3068\u3082\u3042\u308a\u3001\u4f7f\u3048\u308b\u3068\u4fbf\u5229\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Windows7\u4ee5\u964d\u3067\u306f\u6a19\u6e96\u3067powershell\u304c\u4f7f\u3048\u307e\u3059\u3001\u3068\u3044\u3046\u8a71\u3067\u3059\u3002 \u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0(git)\u306e\u30ed\u30b0\u3092\u6574\u5f62\u3057\u305f\u3044\u3053\u3068\u304c\u3042\u308a\u307e\u3057\u305f\u3002 \u30ed\u30b0\u306e\u4e2d\u8eab\u306f\u8907\u6570\u306e\u30b3\u30df\u30c3\u30c8\u306e\u60c5\u5831\u304c\u3042\u308a\u30011\u30b3\u30df\u30c3\u30c8\u306b\u306f\u8907\u6570\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u30ea &hellip; <a href=\"https:\/\/www.ofug.net\/hiroki\/2018\/02\/04\/post-118\/\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[11,10],"tags":[],"class_list":["post-118","post","type-post","status-publish","format-standard","hentry","category-powershell","category-windows"],"views":878,"_links":{"self":[{"href":"https:\/\/www.ofug.net\/hiroki\/wp-json\/wp\/v2\/posts\/118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ofug.net\/hiroki\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ofug.net\/hiroki\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ofug.net\/hiroki\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ofug.net\/hiroki\/wp-json\/wp\/v2\/comments?post=118"}],"version-history":[{"count":0,"href":"https:\/\/www.ofug.net\/hiroki\/wp-json\/wp\/v2\/posts\/118\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ofug.net\/hiroki\/wp-json\/wp\/v2\/media?parent=118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ofug.net\/hiroki\/wp-json\/wp\/v2\/categories?post=118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ofug.net\/hiroki\/wp-json\/wp\/v2\/tags?post=118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}