2

I have a text file that even after removing all the html tags still contains some html codes of apostrophes and other punctuations example :

  It's  // It's 

my question is how to change all of them?

and I'm using a bash script under linux to get the html file

2 Answers 2

2

Alternatively, if you got lynx use it as:

lynx -stdin -dump < file.html

The above will remove the HTML tags too, for example from this file.html

<i>It&#039;s</i>
&lt;<b>&amp;</b>&#62;

prints

   It's <&>
Sign up to request clarification or add additional context in comments.

Comments

1

Using Python:

$ echo 'It&#039;s' | python -c 'import xmllib,sys; print(xmllib.XMLParser().translate_references(sys.stdin.read()))'
It's

Using Perl:

$ echo 'It&#039;s' | perl -MHTML::Entities -pe 'decode_entities($_);'
It's

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.