Move text between 2 phrases - SOLVED

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
steve1040
Posts: 39
Joined: Fri Oct 13, 2006 2:19 am

Move text between 2 phrases - SOLVED

Post by steve1040 »

I have a large file I'm performing some edits so I can import into a database.
The file list the plots of several movies.
The line starting with 'MV:' is the movie
PL: is a line in the plot
BY: is the person who added the plot

For each movie
I want to place a '|'(pipe) after the title and move the plot to be after the pipe, delete 'PL:' and the line starting with BY:.

I have data like this

MV: The Twilight Saga: Eclipse (2010)

PL: Bella once again finds herself surrounded by danger as Seattle is ravaged
PL: by a string of mysterious killings and a malicious vampire continues her
PL: quest for revenge. In the midst of it all, she is forced to choose between
PL: her love for Edward and her friendship with Jacob -- knowing that her
PL: decision has the potential to ignite the struggle between vampire and
PL: werewolf. With her graduation quickly approaching, Bella is confronted with
PL: the most important decision of her life.

BY: Summit Entertainment


I'd like to change it to look like this

MV: The Twilight Saga: Eclipse (2010)|Bella once again finds herself surrounded by danger as Seattle is ravaged by a string of mysterious killings and a malicious vampire continues her quest for revenge. In the midst of it all, she is forced to choose between her love for Edward and her friendship with Jacob -- knowing that her decision has the potential to ignite the struggle between vampire and werewolf. With her graduation quickly approaching, Bella is confronted with the most important decision of her life.


This is what I've tried so far but - I keep having to push "Replace All"

Code: Select all

Find what: ^(PL:.*)\nPL:(.*)$ 
Replace with: \1\2

Thanks
Steve
Last edited by steve1040 on Sat Jul 17, 2010 1:11 pm, edited 1 time in total.
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

How about:

1.
Find what: (MV:.*)\n\nPL:
Replace with: \1|

[X] Regular expression

Replace All
2.
Find what: \nPL:
Replace with: [nothing]

[X] Regular expression

Replace All
3.
Find what: \nBY:.*
Replace with: [nothing]

[X] Regular expression

Replace All
steve1040
Posts: 39
Joined: Fri Oct 13, 2006 2:19 am

Post by steve1040 »

Thanks Ben,
One more question - I just noticed that some of the movies have multiple BY:

Is there a way to delete the section that is between

a line that starts with BY: \n and ends with PL: \n
So if I have
**************************INPUT
MV: Tobacco Road (1941)

PL: Shiftless Jeeter Lester and his family of hillbilly stereotypes live in a
PL: rural backwater where their ancestors were once wealthy planters. Their
PL: slapstick existence is threatened by a bank's plans to take over the land
PL: for more profitable farming; subplots involve the affairs and marriages of
PL: son Dude and daughter Ellie May.

BY: Rod Crawford <puffinus@u.washington.edu>

PL: The story of poor white folks in the South -- the lazy Jeeter Lester and
PL: his long-suffering wife -- is cleaned up a bit for the movie and stresses
PL: comedy more than rural crudeness.

BY: Ed Stephan <stephan@cc.wwu.edu>

PL: In Georgia, near to the Savannah River, the lazy and crook hillbilly Jeeter
PL: Lester lives in the Tobacco Road with his wife Ada, his son Dude and his
PL: single daughter Ellie May in a very poor condition. When the bank decides
PL: to take over his land, the banker George Payne is convinced by his friend
PL: Capt. Tim Harmon to lease the land to Jeeter for US$ 100.00 per year.
PL: Jeeter plots a means to loan the amount from the widow Sister Bessie Rice
PL: that has just received U$ 800.00 from the life insurance company. However,
PL: Bessie decides to get married with Dude and uses the money to buy a brand
PL: new car for Dude. Jeeter plots a means to sell her car while he tries to
PL: marry Ellie May with his son-in-law Lov Bensey that was left by his wife.

BY: Claudio Carvalho, Rio de Janeiro, Brazil

***************MY OUTPUT

MV: Tobacco Road (1941)

PL: Shiftless Jeeter Lester and his family of hillbilly stereotypes live in a
PL: rural backwater where their ancestors were once wealthy planters. Their
PL: slapstick existence is threatened by a bank's plans to take over the land
PL: for more profitable farming; subplots involve the affairs and marriages of
PL: son Dude and daughter Ellie May.

BY: Rod Crawford <puffinus@u.washington.edu>
steve1040
Posts: 39
Joined: Fri Oct 13, 2006 2:19 am

Post by steve1040 »

Thanks I got what I needed using WildEdit
Post Reply