What tool are you using to run the regex?
Oops, I forgot to answer that. Vedit (the text editor) runs regex internally. I don't know whether they programmed that part themselves, or are using code from elsewhere.
if I'm understanding what you want to do (prepend 0s to dates and remove
the comma).
In the simplified test case, yes (plus de-blanking the extra blanks), but in the real case, it's much more than that, including a re-ordering of "fields" to match the mbox spec.
Hartmut W Sager - Tel +1-204-339-8331
On Sat, 4 Jan 2020 at 10:58, Mark Campbell nitrodist@gmail.com wrote:
I don't think you can use \s in the replacement regex as it has no special meaning there. In my local testing with perl, it seems to treat it as a literal escape for the letter s. What tool are you using to run the regex?
Substitute in a space, seems to work as expected:
2020-01-04 10:45:30 ~ TOR-M001 %: ccat test | perl -pe 's/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+([0-9])[\s,]+/\1 0\2 /' From AncientBBS1 Thu Jan 07 1986 20:50:00 2020-01-04 10:45:35 ~ TOR-M001 %: ccat test From AncientBBS1 Thu Jan 7, 1986 20:50:00
What might be easier (and more readable) is if each line has a fixed length from the beginning, you can match perhaps a little more clearly by doing something like s/^(.{23}) (\d),/\1 0\2/ if I'm understanding what you want to do (prepend 0s to dates and remove the comma).
On Sat, Jan 4, 2020 at 10:27 AM Hartmut W Sager hwsager@marityme.net wrote:
[... deleted ...]
Roundtable mailing list Roundtable@muug.ca https://muug.ca/mailman/listinfo/roundtable
Roundtable mailing list Roundtable@muug.ca https://muug.ca/mailman/listinfo/roundtable