I'm writing a bash script that gets some data into a variable and then I need to format the variable. It holds some text in a following manner:
"sth 23 asd 2435 jasbd null asdj 123 jasd j123 asd 24 null asd 436 123jwba null"
I would like to add a newline after every null. How can I do it? My code looks like this:
output=$(curl -s 'http://127.0.0.1:3000/api/com.pokemon.go/nearby?latitude='"$latitude1"'&longitude='"$longitude1"'&altitude=0step=10&offset=0' \
-H 'Authorization: Bearer '"$acces_token")
#bunch of formatting that works
output="${output//[}"
output="${output//]}"
output="${output//pokemons}"
output="${output//pokestops}"
output="${output//gyms}"
output="${output//gym_points}"
output="${output//{}"
output="${output//\}}"
output="${output//\"}"
output="${output//unsigned:false}"
output="${output//unsigned:true}"
output="${output//unsigned:null}"
output=${output//:/ }
output=${output//,/ }
#formatting that doesn't work
output="${output//null/null$'\n'}"
echo $output
but it doesn't work