我正在尝试将下面的输出转换为有效的json输出。无法使用shell脚本解决此问题。
输出
svc pts/0 localhost. Tue Apr 28 21:40 still logged in
svc pts/0 localhost. Tue Apr 28 21:40 - 21:40 (00:00)
svc pts/0 localhost. Tue Apr 28 21:40 - 21:40 (00:00)
...etc
有效的json输出
{
"Result": [{
"models": ["svc pts 0 localhost.Tue Apr 28 21: 40 still logged in",
"svc pts/0 localhost. Tue Apr 28 21:40 - 21:40 (00:00)"
]
}]
}
是否可以转换?有人能提供解决方案吗?
1条答案
按热度按时间aij0ehis1#
您可以使用jq,例如:
program
是产生该输出的程序。