回答編集履歴

3

2023/11/20 16:21

投稿

melian
melian

スコア20574

test CHANGED
@@ -16,8 +16,8 @@
16
16
  for(i in cnt) printf("%s:%4d\n", i, cnt[i])
17
17
  }'
18
18
 
19
- 1: 14
19
+ 2023-01: 14
20
- 2: 24
20
+ 2023-02: 24
21
- 11: 6
21
+ 2023-11: 6
22
- 12: 17
22
+ 2023-12: 17
23
23
  ```

2

2023/11/20 16:18

投稿

melian
melian

スコア20574

test CHANGED
@@ -10,7 +10,7 @@
10
10
  2023-02-10 21:00:00.000000000 +0900 8.txt
11
11
  2023-01-20 21:00:00.000000000 +0900 9.txt
12
12
 
13
- $ find data -maxdepth 1 -type f -printf '%TY-%Tm ' -exec wc -l {} \; |
13
+ $ find . -maxdepth 1 -type f -printf '%TY-%Tm ' -exec wc -l {} \; |
14
14
  awk '{ cnt[$1] += $2 }END{
15
15
  PROCINFO["sorted_in"] = "@ind_str_asc"
16
16
  for(i in cnt) printf("%s:%4d\n", i, cnt[i])

1

2023/11/20 16:13

投稿

melian
melian

スコア20574

test CHANGED
@@ -1,4 +1,3 @@
1
- ※ タイムスタンプの「月」のみで集計しています。
2
1
  ```bash
3
2
  $ stat -c "%y %n" *.txt
4
3
  2023-11-09 20:00:00.000000000 +0900 1.txt
@@ -11,11 +10,10 @@
11
10
  2023-02-10 21:00:00.000000000 +0900 8.txt
12
11
  2023-01-20 21:00:00.000000000 +0900 9.txt
13
12
 
14
- $ find . -type f |
15
- xargs -I@ sh -c 'printf "%d %d\n" $(date -r "@" +"%m") $(cat "@" | wc -l)' |
13
+ $ find data -maxdepth 1 -type f -printf '%TY-%Tm ' -exec wc -l {} \; |
16
14
  awk '{ cnt[$1] += $2 }END{
17
- PROCINFO["sorted_in"] = "@ind_num_asc"
15
+ PROCINFO["sorted_in"] = "@ind_str_asc"
18
- for(i in cnt) printf("%2d:%4d\n", i, cnt[i])
16
+ for(i in cnt) printf("%s:%4d\n", i, cnt[i])
19
17
  }'
20
18
 
21
19
  1: 14