cardano-community / guild-operators

Artifacts and scripts created by Guild operators
https://cardano-community.github.io/guild-operators
MIT License
354 stars 178 forks source link

guild-topology.sh: processing JSON with awk and sed #885

Closed riptl closed 3 years ago

riptl commented 3 years ago

Describe the bug

The script files/docker/node/addons/guild-topology.sh uses a complicated awk / tail / sed / grep pipe construction to extract data from JSON.

https://github.com/cardano-community/guild-operators/blob/724aa0dc76eb9b23a4240db720381c15ca361bd7/files/docker/node/addons/guild-topology.sh#L7

Expected behavior

It would be more appropriate to use a JSON processing tool like jq to process JSON to avoid data parsing errors.

redoracle commented 3 years ago

It depends from how you want the data extraction.. there is no wrong way of doing it if it works, as in this case.

nyetwurk commented 3 years ago

jq is more appropriate for processing .json data, regardless of the desired output format, which, in this case, also happens to be json.

redoracle commented 3 years ago

Ok.. thanks for your feedback.

Il gio 8 apr 2021, 18:14 Nye Liu @.***> ha scritto:

jq is more appropriate for processing .json data, regardless of the desired output format, which, in this case, also happens to be json.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/cardano-community/guild-operators/issues/885#issuecomment-815996250, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJEHHWFOTHFPY33HV33XV3THXQAVANCNFSM42TI6LUQ .