Tool for Search and Replace across multiple files.
maxdido
Posts: 4 Joined: Sun Apr 01, 2012 9:20 am
Post
by maxdido » Sun Apr 01, 2012 10:55 am
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>
maxdido@gmx.de
Post
by maxdido@gmx.de » Mon Apr 02, 2012 6:56 pm
is it even possible with textcrawler ?? Have no idea.
maxdido@gmx.de
Post
by maxdido@gmx.de » Mon Apr 02, 2012 7:34 pm
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
Fool4UAnyway
Post
by Fool4UAnyway » Mon Apr 02, 2012 11:55 pm
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
maxdido@gmx.de
Post
by maxdido@gmx.de » Tue Apr 03, 2012 12:23 pm
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
maxdido@gmx.de
Post
by maxdido@gmx.de » Tue Apr 03, 2012 7:50 pm
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
Fool4UAnyway
Post
by Fool4UAnyway » Thu Apr 05, 2012 11:19 pm
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
maxdido@gmx.de
Post
by maxdido@gmx.de » Mon Apr 09, 2012 6:48 pm
Oh now I see.
That would have been better indeed.