I've been trying to remove the new line and carriage return indicators from my JSON output using this answer.
I've also tried running this based on another answer I've seen on Stack Overflow, but it still does not appear to be working:
sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' text.json > text_clean.json
My current .sh
script looks like this:
getPage() {
curl --fail -X GET 'https://api.test.com/v1/marx?page=1&pageSize=1000&sort=desc' \
-H 'Authorization: Bearer xxxxxxx' \
-H 'cache-control: no-cache'
}
getPage \
| jq -c '.data[]' \
> text.json
What am I missing here?
If it helps, an example of the string containing it takes on many different forms in the output, but here's a good one:
Ok! Thank you so much.\r\nBest,\r\nClaire\r\n\r\n