回答編集履歴

3

2023/02/08 08:24

投稿

melian
melian

スコア19825

test CHANGED
@@ -1,8 +1,5 @@
1
1
  ```bash
2
- {
3
- printf ' '
2
+ printf ' %s\nPKM %s\n' \
4
- (cd output; echo *.txt | sed 's/\.txt//g')
3
+ "$(cd output; echo *.txt | sed 's/\.txt//g')" \
5
- printf 'PKM '
6
- awk '$1=="PKM"{print $4}' output/*.txt | xargs
4
+ "$(awk '$1=="PKM"{print $4}' output/*.txt | xargs)" > result.txt
7
- } > result.txt
8
5
  ```

2

2023/02/08 08:11

投稿

melian
melian

スコア19825

test CHANGED
@@ -1,7 +1,7 @@
1
1
  ```bash
2
2
  {
3
3
  printf ' '
4
- (cd output; echo *.txt | sed 's/\.txt//g') | xargs
4
+ (cd output; echo *.txt | sed 's/\.txt//g')
5
5
  printf 'PKM '
6
6
  awk '$1=="PKM"{print $4}' output/*.txt | xargs
7
7
  } > result.txt

1

2023/02/08 07:52

投稿

melian
melian

スコア19825

test CHANGED
@@ -1,6 +1,8 @@
1
1
  ```bash
2
+ {
2
- for f in output/*.txt
3
+ printf ' '
4
+ (cd output; echo *.txt | sed 's/\.txt//g') | xargs
3
- do
5
+ printf 'PKM '
4
- awk -v fname="$(basename $f .txt)" '$1=="PKM"{printf("%s\n%s\n", fname, $4)}' $f
6
+ awk '$1=="PKM"{print $4}' output/*.txt | xargs
5
- done > result.txt
7
+ } > result.txt
6
8
  ```