0

I have a log file containing html code i need to delete all the content between html tags for every possible match in this file. How is that possible using filters?

Example of my file:

some text here
<html>
code
</html>
some text there
<html>
code
</html>
some other text

The output should be:

some text here
some text there
some other text

2 Answers 2

1

This awk should do:

awk '/<html>/{f=1;next} !f; /<\/html>/{f=0}' file
some text here
some text there
some other text
Sign up to request clarification or add additional context in comments.

Comments

1

why not just:

sed '/<html>/,/<\/html>/d'

it works for your example.

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.