I store different variance of the below in an xml file. and apparently, xml has an issue loading up data like this because it contains html tags. i would like to preserve this data as it is, but unfortunately, xml says i cant.
so i have to strip out all the html tags.
the examples i found online tend to strip out the tags AND also the content, which i dont want. i need the content. i just want to get rid of the HTML tags.
below is the code:
echo "OK: strings of [ <bye xmlns=http://check.google.com/schema/2 serial-number= ] was found in the response
from the URL [ http://sky.net:80/schock/google/pinging ].
Actual response received = [ <bye xmlns=http://check.google.com/schema/2 serial-number=fafafafafaf /> ]." | sed 's/<[^>]*>//g'
Response:
OK: strings of [ ].
Not sure what you want for your desired output, but this will get rid of the "<>" tags:
echo "OK: strings of [ <bye xmlns=http://check.google.com/schema/2 serial-number= ] was found in the response from the URL [ http://sky.net:80/schock/google/pinging ]. Actual response received = [ <bye xmlns=http://check.google.com/schema/2 serial-number=fafafafafaf /> ]." | sed "s|[<|>]||g"
OK: strings of [ bye xmlns=http://check.google.com/schema/2 serial-number= ] was found in the response from the URL [ http://sky.net:80/schock/google/pinging ]. Actual response received = [ bye xmlns=http://check.google.com/schema/2 serial-number=fafafafafaf / ].
im gonna try to this to see if it works. cant post any output because the output wont be the same. i have hundreds of data similar to this. and they're not all similar. i just want to keep the html tags from being a nuisance.
microsoft excel cant load up an xml file if it has these html tags in them.
OK: strings of [ bye xmlns=http://check.google.com/schema/2 serial-number= ] was found in the response from the URL [ http://sky.net:80/schock/google/pinging ]. Actual response received = [ bye xmlns=http://check.google.com/schema/2 serial-number=fafafafafaf / ].
so the variable called "$Output", contains the information that i'm trying to strip html tags from.
since there are so many characters that can be in an html tag, i dont know what characters will be in all the information that will be placed in the "$Output" variable.
so i'm hoping there's a sed/awk one liner that can take into account all html tags/characters, and remove them from my output. i'm presuming someone here would know about html and all the tags it has.