回答編集履歴

2

追記。

2022/10/20 13:44

投稿

shiketa
shiketa

スコア4052

test CHANGED
@@ -14,3 +14,13 @@
14
14
  (true_2347087436712_490.00_150.00_640_0315764274_Biabia Kudi_Oto Obong_12102022_1)
15
15
  (true_2347087436712_111.11_222.22_333.33_0315764274_Biabia Kudi_Oto Obong_12102022_1)
16
16
  ```
17
+
18
+ ---
19
+
20
+
21
+ arcxorさんの回答を参考に。こうも書けますね。
22
+
23
+ ```
24
+ ...
25
+ awk -F_ 'BEGIN{ OFS="_" }{ print($1, $2, $3, $4, sprintf("%.2f", $3 + $4), $6, $7, $8, $9, $10) }'
26
+ ```

1

typo

2022/10/20 12:58

投稿

shiketa
shiketa

スコア4052

test CHANGED
@@ -1,11 +1,16 @@
1
1
  awk案件かな。
2
2
 
3
3
  ```
4
+ (
5
+ cat <<EOD
4
- $ echo "(true_2347087436712_490.00_150.00_0.00_0315764274_Biabia Kudi_Oto Obong_12102022_1)" \
6
+ (true_2347087436712_490.00_150.00_0.00_0315764274_Biabia Kudi_Oto Obong_12102022_1)
7
+ (true_2347087436712_111.11_222.22_0.00_0315764274_Biabia Kudi_Oto Obong_12102022_1)
8
+ EOD
9
+ ) |\
5
- | awk -F_ 'BEGIN{ OFS="_" }{ print($1, $2, $3, $4, $3 + $4, $6, $7, $8, $9, $10) }'
10
+ awk -F_ 'BEGIN{ OFS="_" }{ print($1, $2, $3, $4, $3 + $4, $6, $7, $8, $9, $10) }'
11
+ ```
12
+
13
+ ```
6
14
  (true_2347087436712_490.00_150.00_640_0315764274_Biabia Kudi_Oto Obong_12102022_1)
7
-
8
- $ echo "(true_2347087436712_111.11_222.22_0.00_0315764274_Biabia Kudi_Oto Obong_12102022_1)" \
9
- | awk -F_ 'BEGIN{ OFS="_" }{ print($1, $2, $3, $4, $3 + $4, $6, $7, $8, $9, $10) }'
10
15
  (true_2347087436712_111.11_222.22_333.33_0315764274_Biabia Kudi_Oto Obong_12102022_1)
11
16
  ```