我使用下面的长命令来获得JSON值7.3.9-win-x64.msi
,我将其包含在下面.
$ cat json.txt | jq -r '.[] | .[] | .[] | .[].management | .[0].microsoft | .shell.associated.scripting.component.windows.powershell'
对于JSON代码,它是:
{
"PowerShell": {
"is a task": {
"automation": [
{
"and": "configuration",
"management": [
{
"program": "from",
"microsoft": {
"consisting of": "a command-line",
"shell": {
"and": "the",
"associated": {
"scripting": {
"language.": "initially a windows",
"component": {
"only": "known as",
"windows": {
"powershell": "7.3.9-win-x64.msi",
"it was made": "open-source"
}
}
}
}
}
}
}
]
},
{
"the former": "is built on the .NET Framework",
"the latter on": ".NET (previously .NET Core)."
}
]
}
}
}
当我试图应用从互联网上的几篇文章中获得的几种方法来以更短的方式获得相同的价值时,我失败了.那么,有没有更短的命令来做到这一点呢?