0

json={"PlatformID":1024,"SystemId":11640,"SystemName":"010.10.10.010","DomainName":null,"AccountId":15631,"AccountName":"merg1","AccountNameFull":"merg1","ApplicationID":null,"ApplicationDisplayName":null,"MaximumReleaseDuration":120,"MaxReleaseDurationDays":0,"MaxReleaseDurationHours":2,"MaxReleaseDurationMinutes":0,"InstanceName":"","DefaultReleaseDuration":120,"DefaultReleaseDurationDays":0,"DefaultReleaseDurationHours":2,"DefaultReleaseDurationMinutes":0,"LastChangeDate":"2019-08-21T10:53:25.237","NextChangeDate":null,"IsChanging":false,"IsISAAccess":false,"PreferredNodeID":"3ef3e7c7-5851-451b-b1a4-c62556b588ce"}

grep SystemId | awk -F ':' '{print $2}' $json

I am getting error for reading - Filename too long.

Can anyone help me how to get the SystemID.

jww
  • 97,681
  • 90
  • 411
  • 885
tata
  • 33
  • 3
  • Welcome to SO. You may want to read [ask] and [mcve] and edit your question accordingly. – bruno desthuilliers Dec 18 '19 at 11:09
  • 2
    Possible duplicate of [Parsing JSON with Unix tools](https://stackoverflow.com/q/1955505/608639), [How to grep the specific field value from json string using shell script](https://stackoverflow.com/q/39757409/608639), [Extract JSON object using Bash shell?](https://stackoverflow.com/q/22316714/608639), [How to parse JSON with shell scripting on Linux?](https://stackoverflow.com/q/22678461/608639), etc. – jww Dec 18 '19 at 11:27
  • And your other question: [Parse JSON response using shell script](https://stackoverflow.com/q/59388684/608639)... – jww Dec 18 '19 at 11:47

1 Answers1

0

Looks like the content of $json gets interpreted as the filename and is reported as being to long.

Try: echo $json | awk -F ':' '{print $3}' | cut -d ',' -f1

mottek
  • 929
  • 5
  • 12