鍍金池/ 問答/Linux  HTML/ shell 腳本 如何解析這段字符串?

shell 腳本 如何解析這段字符串?

以下是網(wǎng)絡(luò)返回的一段字符串,我想在 shell 腳本中解析這段字符串,獲取 fsize 的值,也就是 13431719
請問該怎么做?

2018-06-14 14:38:26,380 - DEBUG - wcscmd version 1.0.0
2018-06-14 14:38:26,381 - DEBUG - Updating Config.Config ishttps->None
2018-06-14 14:38:26,381 - DEBUG - Updating Config.Config limit->None
2018-06-14 14:38:26,381 - DEBUG - Updating Config.Config marker->None
2018-06-14 14:38:26,381 - DEBUG - Updating Config.Config mode->None
2018-06-14 14:38:26,382 - DEBUG - Updating Config.Config output->None
2018-06-14 14:38:26,382 - DEBUG - Updating Config.Config overwrite->None
2018-06-14 14:38:26,382 - DEBUG - Updating Config.Config prefix->None
2018-06-14 14:38:26,382 - DEBUG - Updating Config.Config separate->None
2018-06-14 14:38:26,382 - DEBUG - Updating Config.Config upload_id->None
2018-06-14 14:38:26,382 - DEBUG - Command: stat
2018-06-14 14:38:26,383 - DEBUG - Start to get the stat of rsrj-test001:vikii/test02.mp4
2018-06-14 14:38:26,603 - DEBUG - (200, {'mimeType': 'video/mp4', 'code': 200, 'hash': 'ltVu-sfde4Uoq-86-gvx3Ase_j70', 'name': 'vikii/test02.mp4', 'fsize': 13431719, 'expirationDate': '', 'message': 'OK', 'putTime': 1528958272000L, 'result': True}, {'x-reqid': '202829121214713520180614143826YQP4KbiG'})
回答
編輯回答
失心人

egrep -o "'fsize': (\d*)" txt | cut -d ' ' -f 2

給你一種,自己思考下其他方法吧

2017年10月19日 17:56
編輯回答
逗婦乳

grep -Po "200.+?'fsize': \K\d+"

2018年5月3日 12:29
編輯回答
陌離殤
grep -Po "'fsize': +\d+" test.log   | cut -d ' ' -f 2
2018年2月28日 01:09