We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fab039a commit 73609dfCopy full SHA for 73609df
answer/8.md
@@ -7,3 +7,9 @@ $ awk -F: '{print $(NF-2)}' access.log | awk '$1<"12"{print "午前"} $1>="12"{p
7
別解1(上田)$ cat access.log | grep -o '..:..:.. +0900' | sed 's/:.*//' | awk '{print $1<"12"?"午前":"午後"}'| sort | uniq -c
8
別解2(eban、上田改)$ sed -r 's@.*\[|\]|/@@g;s/:/ /' access.log | date -f- +%p | sort | uniq -c
9
```
10
+
11
+### 読者別解
12
+```
13
+$ cat access.log | sed -E 's/://g;s/^.*([0-9]{6}).*$/\1/' | awk 'BEGIN{am=0;pm=0}$1<120000{am+=1}$1>=120000{pm+=1}END{print am " 午前";print pm " 午後"}'
14
15
0 commit comments