我有一个文件input.txt
,它实际上是一个逗号分隔的列表
嵌入在JSON结构中的字符串,其中行内的数据
由管道(|
)分隔。
注意last operation
列是如何在所需的输出中分割为LastOperation和OperationTime的。
在这种情况下,使用两个空格作为字段分隔符/分隔符。?
输入json文件是:
'{
"info": {
"status": "succ",
"type": "command"
},
"data": {
"list": [
"CommQ data set name: test.ttq1.tt2.tt3",
" size: 19169280 bytes",
" used: 537320 bytes",
"Destination name|status| last operation | sent |queued|address",
"testifLAPPXDgx01 |active|Send OK 14.02.22 07 SEP| 26| 0|testifLAPPXDgx01..test.server ",
"testifLAPPXDgx02 |active|Send OK 14.02.22 07 SEP| 12| 0|testifLAPPXDgx02..test.server ",
"testifLAPPXDgx30 |active|Send OK 14.01.49 07 SEP| 7| 0|testifLAPPXDgx30..test.server ",
"testifLAPPXDgx40 |active|Send OK 14.01.49 07 SEP| 7| 0|testifLAPPXDgx40..test.server ",
"1105 senders, 0 quiesced"
]
}
}'
需要输出:
[
{
"Destination": "testifLAPPXDgx01",
"Status": "active",
"LastOperation": "SEND OK",
"OperationTime": "14.01.49 07 SEP",
"Sent": 7,
"Queued": 0,
"Address": "testifLAPPXDgx01..test.server"
},
{
"Destination": "testifLAPPXDgx02",
"Status": "active",
"LastOperation": "SEND OK",
"OperationTime": "14.02.22 07 SEP",
"Sent": 26,
"Queued": 0,
"Address": "testifLAPPXDgx02..test.server"
}
]