Page 1 of 1

How to move a line of text to another place in the text file

Posted: Sun Apr 01, 2012 10:55 am
by maxdido
I would like to move "<id>tt1423894</id>" in between the "watched" and "genre" tags
from this:

Code: Select all

<movie>
    <id>tt1423894</id>
    <title>Barney's Version</title>
    <plot></plot>
    <genre></genre>
    <rating></rating>
    <year>2010</year>
    <outline></outline>
    <plot></plot>
    <tagline></tagline>
    <thumb>file:///E:/UMC/Barney's Version[Cover].jpg</thumb>
    <fanart>file:///E:/UMC/Barney's Version[Backdrop].jpg</fanart>
    <watched></watched>
    <genre></genre>
</movie>
to this:

Code: Select all

<movie>
    <title>Barney's Version</title>
    <plot></plot>
    <genre></genre>
    <rating></rating>
    <year>2010</year>
    <outline></outline>
    <plot></plot>
    <tagline></tagline>
    <thumb>file:///E:/UMC/Barney's Version[Cover].jpg</thumb>
    <fanart>file:///E:/UMC/Barney's Version[Backdrop].jpg</fanart>
    <watched></watched>
    <id>tt1423894</id>
    <genre></genre>
</movie>

Re: How to move a line of text to another place in the text

Posted: Mon Apr 02, 2012 6:56 pm
by maxdido@gmx.de
is it even possible with textcrawler ?? Have no idea.

Re: How to move a line of text to another place in the text

Posted: Mon Apr 02, 2012 7:34 pm
by maxdido@gmx.de
I tried to do this in the standard tab, but didn't work.

Find: (regexforline1\r\n)(regexforline2\r\n)(regexforline3\r\n)(regexforline4\r\n)(regexforline5\r\n)(regexforline6\r\n)(regexforline7\r\n)(regexforline8\r\n)(regexforline9\r\n)(regexforline10\r\n)(regexforline11\r\n)(regexforline12\r\n)(regexforline13)

Replace: $1$3$4$5$6$7$8$9$10$11$2$12$13

Re: How to move a line of text to another place in the text

Posted: Mon Apr 02, 2012 11:55 pm
by Fool4UAnyway
Short description:

Find:
(marker) line (marker) any text, target marker 1, target marker 2

Replace by:
(marker) (marker) any text, target marker 1, line, target marker 2

You could reduce the number of group( placeholder)s.

[(marker)] [line] [(marker) any text, target marker 1] [target marker 2]
->
[(marker)] [(marker) any text, target marker 1] [line] [target marker 2]

The first marker may not even be necessary, the same goes for the second marker, and the second target marker. So, very short this would be [line][any text up to and including target marker] -> $2$1

Re: How to move a line of text to another place in the text

Posted: Tue Apr 03, 2012 12:23 pm
by maxdido@gmx.de
Instead of using, marker, line, any text could you specify more towards my example. I'm sorry but I don't understand the way you described it.

perhaps you can give a small example with 3 lines then I'll try to figure it out for my example. More like this:

line1
line2
line3

find: code
replace: code

line1
line3
line2

Re: How to move a line of text to another place in the text

Posted: Tue Apr 03, 2012 7:50 pm
by maxdido@gmx.de
I found it. Cool. Thanks for setting me in the right (a bit cryptic ;) ) direction.

FIND:
(<movie>)\r\n
(<id>*.*</id>)\r\n
(<title>*.*</title>)\r\n
(<rating>*.*</rating>)\r\n
(<year>*.*</year>)\r\n
(<outline>*.*</outline>)\r\n
(<plot>*.*</plot>)\r\n
(<tagline>*.*</tagline>)\r\n
(<thumb>*.*</thumb>)\r\n
(<fanart>*.*</fanart>)\r\n
(<watched>*.*</watched>)\r\n
(<genre>*.*</genre>)\r\n
(</movie>)

REPLACE:
$1
$3
$4
$5
$6
$7
$8
$9
$10
$11
$2
$12
$13

Re: How to move a line of text to another place in the text

Posted: Thu Apr 05, 2012 11:19 pm
by Fool4UAnyway
My suggestion was to not split all texts into individual lines.

Find:
(<movie>.*</id>\r\n)
(<title>.*</title>\r\n)
(<rating>.*</watched>\r\n)
(<genre>.*</movie>)

Replace by:
$1$3$2$4

Re: How to move a line of text to another place in the text

Posted: Mon Apr 09, 2012 6:48 pm
by maxdido@gmx.de
Oh now I see.
That would have been better indeed.