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>
0

1 Answer 1

1

I figured it out! Works with:

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

thank you, anyway.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .