Page 1 of 1

New column displaying a part of filename

Posted: Thu Apr 04, 2024 12:01 pm
by sk2107
Hi,

I have renamed my files regarding certain categories by having few letters in the beginning of the file ends by # and the rest of the name .
for example:
abc#aaaafffffsaaa.jpg
RRRRR#kkkffff srrrwwww ww.avi
.... etc


Now in order to have some operation like filtering, distinct, unique...etc) regarding first part before the #, I need to create a new column holding that part, as in my example column will be:
abc#
RRRRR#
.... etc



Thank you

Re: New column displaying a part of filename

Posted: Thu Apr 04, 2024 2:30 pm
by NotNull
If you want the Category to include the #:

Code: Select all

regex:^(.+?#)   add-column:A   A-label:=Category   A:=regmatch1: 
Without the #:

Code: Select all

regex:^(.+?)#   add-column:A   A-label:=Category   A:=regmatch1: 

Re: New column displaying a part of filename

Posted: Thu Apr 04, 2024 2:48 pm
by sk2107
Great. thank you,

Can I add another column to have the length of the result (len of A column)

Best regards

Re: New column displaying a part of filename

Posted: Thu Apr 04, 2024 4:50 pm
by NotNull
sk2107 wrote: Thu Apr 04, 2024 2:48 pm Can I add another column to have the length of the result (len of A column)
Nobody is stopping you ;)

Code: Select all

regex:^(.+?)#   add-column:A;B   A-label:=Category   A:=regmatch1:   B-label:=Length   B:=len($regmatch1:) 

Re: New column displaying a part of filename

Posted: Thu Apr 04, 2024 5:03 pm
by sk2107
Perfect. Thanks a lot

Best regards