Reverse the rename pair

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Reverse the rename pair

Postby forjob29 » Sun Mar 16, 2014 6:14 pm

I have asked this question under the general comments but i am asking it again here.

http://www.bulkrenameutility.co.uk/forum/viewtopic.php?f=5&t=2193#p5659

Kindly reply for the same.
forjob29
 
Posts: 2
Joined: Fri Mar 14, 2014 7:59 am

Reverse rename pairs

Postby truth » Mon Mar 17, 2014 11:53 am

BRU wont reverse the OrigName|NewName behavior.
You would need to create a file with reversed text-lines as: NewName|OrigName

The following command creates such a file (non-Unicode only):
FOR /f "delims=| tokens=1,2" %a in (renames.txt) do @echo %b^|%a>>reverse.txt

For Unicodes, I prefer sed to automate such conversions:
SED -r "s/(.*)(\|)(.*)/\3\2\1/" renames.txt > reverse.txt
truth
 
Posts: 221
Joined: Tue Jun 25, 2013 3:39 am
Location: Earth, OrionArm, MilkyWay

Re: Reverse the rename pair

Postby Bobbyfoo101 » Thu Jun 16, 2022 1:43 am

I've tried using the above SED example but the resulting file is blank. This is my string in a batch file: SED -r "s/(.*)(\|)(.*)/\3\2\1/" 2x2_Renaming_Pairs.txt >> 2x2_Renaming_Pairs_Gatherer.txt

Can you help me understand what I might be doing wrong here?
Bobbyfoo101
 
Posts: 1
Joined: Thu Jun 16, 2022 1:33 am


Return to BRU Support