#1 2024-01-09 20:21

autryld
Member
Registered: 2024-01-09
Posts: 3

Delimiter from $n to end of filename

Hello,
This is great renaming tool. It renames using techniques the other tool doesn't. Thanks to the developers! There's just one thing I can't figure out (so far smile ).

I would like to use space as the delimiter but only for the first 3 delimited parts. I want to ignore the remaining positions on rewrite.  I have been unable to find or figure out how it might be done.  The alternative would be to use awk in Linux but this seems much easier with ReNamer  if only I could find out how to ignore positions n-$ (n through the end of the filename. Ignoring the extension of course.)


Here is a dummy file name.
2001-12-09 JohnSmith #299 Murder Done Wrong & Knights at Night.mp3

Exampe target filename:
#299 2001-12-09 JohnSmith - Murder Done Wrong & Knights at Night.mp3


Thanks,
Larry

Offline

#2 2024-01-11 00:42

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,393

Re: Delimiter from $n to end of filename

There are a few ways of achieving this:

A) Rearrange rule: Split by exact pattern of delimiters " #| ", new pattern "#$2 $1 - $3".

B) Regular Expressions rule: Replace expression "\A(.+?)\s+(\#\d+)" with pattern "$2 $1 -".

C) Pascal Script rule: This one would be more complex, so let's keep this as the last resort.

Offline

#3 2024-01-15 05:24

autryld
Member
Registered: 2024-01-09
Posts: 3

Re: Delimiter from $n to end of filename

Thank you.
The Regular Expression rule worked! I have some experience with sed and vi but only for straightforward string replacement.  Thanks!

The Rearrange rule did not seem to work, unfortunately. 

Thanks,
Larry

Offline

#4 2024-01-16 14:28

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,393

Re: Delimiter from $n to end of filename

autryld wrote:

The Rearrange rule did not seem to work, unfortunately.

You might have missed the required spaces around the split pattern " #| ".

Here is the demo of it working for your example filename:

renamer-rearrange-2994.png

Offline

#5 2024-01-30 19:48

autryld
Member
Registered: 2024-01-09
Posts: 3

Re: Delimiter from $n to end of filename

den4b wrote:
autryld wrote:

The Rearrange rule did not seem to work, unfortunately.

You might have missed the required spaces around the split pattern " #| ".

Here is the demo of it working for your example filename:

https://www.den4b.com/forum/img/members … e-2994.png

That's exactly what happened. Thanks for pointing that out.



--
Larry

Offline

Board footer

Powered by FluxBB