I have a command that I run and it gives an output like below:
{
\"endpointApplications\": {
\"App_Name\": {
\"connectionState\": \"Disconnected\",
You should use jq for stuff like that:
jq -c . input.txt
An alternative quick a dirty solution would be to use sed
& tr
:
sed -e 's/^ *//' < input.txt | tr -d '\n'
although I would recommend using jq
which is designed for manipulating JSON. jq
is like sed
for JSON. Manipulating JSON textually with sed
/awk
/etc is not guaranteed to produce semantically equivalent JSON.