0

I have the following code...it is mostly working. Except I am wanting to write the result of sed into the variable newData. Have viewed many other posts, and none have managed to work for me.

newin="<font color='default'>Default Color has been choosen.</font>"

newData="$newin" | sed 's/&lt;/</g; s/&gt;/>/g; s/<[^>]*>//g'

if [[ ${newin:0:1} == "<" ]]
then

    #this echo works like it should
    echo "$newin" | sed 's/&lt;/</g; s/&gt;/>/g; s/<[^>]*>//g'

    #this echo works like it should

    echo "$newin"

    #The variable newData does not seem to capture the data
    newData=${newin} | sed 's/&lt;/</g; s/&gt;/>/g; s/<[^>]*>//g'
    echo "[$newdata]"

fi

it outputs:

Default Color has been choosen.
<font color='default'>Default Color has been choosen.</font>
[]
David C. Rankin
  • 81,885
  • 6
  • 58
  • 85
user1305988
  • 119
  • 2
  • 13

0 Answers0