Delete all lines except the ones that have certain words with TextWrangler

1

I have many files which I want to delete all the lines except the lines that have certain words. I tried to do it with TextWrangler: Text > Process Lines Containing… But only does it word by word. I am on OS X. I would appreciate your help. Thank you

My files are like these: (other files have more lines)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<movie>
    <title>Robotron</title>
    <originaltitle></originaltitle>
    <id></id>
    <mpaa></mpaa>
    <actor>
      <name></name>
      <thumb>   .jpg</thumb>
      <name></name>
      <thumb>   .jpg</thumb>
    </actor>
  <genre>Action</genre>
  <genre>Drama</genre>
</movie>

I want to delete all the lines except the lines that have the words: xml, movie, title, id, actor, name and genre; and copy them to a new file. Is this possible?

Desired result in new file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<movie>
    <title>Robotron</title>
    <id>Robotron</id>
  <actor>
    <name></name>
    <name></name>
  </actor>
  <genre>Action</genre>
  <genre>Drama</genre>
</movie>

user3475927

Posted 2016-09-11T01:15:32.183

Reputation: 21

Answers

1

I figured it out! Works with:

(<\?xml|<movie>|</movie>|</id>|</title>|<actor>|</actor>|</name>|</genre>|</year>)

thank you, anyway.

user3475927

Posted 2016-09-11T01:15:32.183

Reputation: 21