Page 1 of 1

Reverse the rename pair

PostPosted: Sun Mar 16, 2014 6:14 pm
by forjob29
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.

Reverse rename pairs

PostPosted: Mon Mar 17, 2014 11:53 am
by truth
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

Re: Reverse the rename pair

PostPosted: Thu Jun 16, 2022 1:43 am
by Bobbyfoo101
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?