A regular expression to match the seconds is trivial: m\d+s.
The problem is that a regular expression works on a single string. There is no way for a pure regex solution to group the files by the start of the name and then apply a sequential number, because the regex only sees one filename at a time, and doesn't maintain any state between invocations.
If you want to do this in code, it should be fairly easy, but you'd need to specify which language you were using.
If you want to use a renamer tool, you'll need to consult the documentation to see if it can do this sort of thing, and if so, how.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Richard, very sorry for late reply. I'm on a new browser and forgot to put in new bookmark folder for my posts!
Richard, my renamer is good at handling renaming files, it's just the regex part that I dont' know how to deal with. The renamer is fantastic but in one of my crashes, I lost years worth or regex naming files all in one backup file. It was a great loss. And it handled all sorts of difficult things like this. But the renamer's forum is gone so no going back to my posts there to try to rebuild.
All that's needed is the before and after, as it were. How to go from scenarios like this within the file name:
06h36m03s- filename a
06h36m05s- filename b
06h36m12s- filename c
06h36m21s- filename d
06h36m33s- filename e
to padded from 1-9 if more than 9
i.e., if above went to 10 and beyond
06h36.1- filename a
06h36.2- filename b
06h36.3- filename c
06h36.4- filename d
06h36.5- filename e
to padded from 1-9 if more than 9:
06h36.01- filename a
06h36.02- filename b
06h36.03- filename c
06h36.04- filename d
06h36.05- filename e
06h36.06- filename f
06h36.07- filename g
06h36.08- filename h
06h36.09- filename i
06h36.10- filename j
06h36.11- filename k
I know it's a tall order but my renamer handled this type of complexity and more! I had files generated by screenshot app and recorded radio programs with all sorts of different naming conventions, and for years I used this app with perfect results. It's just that in the switch to a new computer, and all but 1 backup option, I lost of my years of scripting.
Personally I'm confused by what you say concerning the fabrication of "seconds" from the original set of strings returned. How do you account for the fact that sequentially, 10 (counting ten) tenths adds up to one? "Over 9 files": what the heck does that mean?
In my defense I'd also like to point out that after many years of observing columns of Date Modified, Date Created, Date Accessed windows time stamps (even in MSDOS this is true), what shows is ALWAYS sortable as some "true" time. Despite two "time stamps" of the same look, underneath the msification is a millisecond disposition.
I want to be able to use the content of a database table as part of a regex expression. This isn't the actual use case, but it shows what I want to do.
Database table includes a field with customer names, "Acme","Starbucks","Delta". This table gets updated with new customers daily.
I have a simple RegEx that looks for the existence of some text in an OCR'd document. (?i)(Acme|Starbucks|Delta)
I want to update the RegEx statement with the new entries. I know I can do it through some external scripting, but what I would like to do is embed some sort of call to the table and column a the time of execution, like "(?i)(ODBC Hook to the data here)"
I am having a text file having some text to be remove enclosed within a defined tag (234 in the example below). This to-be removed text is not fixed and can occur multiple times in a single line OR can be spanned across multiple lines.
With this expression- "(\d)([\s\S]*?)(\d)", I am able to find out and replace the text with "" as expected but the problem occurs wherein the line ends with the tag (234) and the same line either starts with the tag (234) or in the continuation to the previous line like lines 2 and 6 in the above example. The problem is, line 2 and 6 are leaving a blank line behind and so the output contains 7 lines while I am expecting 5 lines (line 2 and 6 should be removed) only.
I'd use a text (file) editor and do a replace all.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
I'm trying to figure how to 'find and replace' a textstring within a textfile. But the find and replace within the file has to only start after a certain textstring and it also has to stop before a second textstring. Can that be done with regex? Or would that require code (Python for instance).
I've a weird situation. I created a regex expression for one of the service. I've tested this expression at regexr.com and regex101.com and there are no problems at all. when I used this regex expression in fail2ban, it missed all the lines.
here is the log output;
[05-Oct-2021 17:09:39 +0300]: IMAP Error: Login failed for email@example.com against localhost from126.96.36.199. AUTHENTICATE PLAIN: Authentication failed. in /usr/share/roundcube/program/lib/Roundcube/rcube_imap.php on line 204 (POST /webmail/?_task=login&_action=login)
fail2ban regexes are a bit "different", particularly with the new(ish) prefixes and interpolations.
Your best bet is to use "fail2ban-regex".
Somewhere around the fail2ban site there is a tutorial about iincremental development of regexes.
It's a bit outdated, but the process works.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
Last Visit: 31-Dec-99 18:00 Last Update: 26-Sep-22 6:52