On 2021-09-04, rwmit...@gmail.com <rwmitchell@gmail.com> wrote:
> I'm just curious, is the file being otherwise edited in vim? I usually
> just use less to view logs, in which case, a command line filter would be
> more efficient (for me).
Thanks that's a good suggestion in general. In this case, yes, I am
going to perform more editing.
> On Saturday, September 4, 2021 at 11:23:28 AM UTC-4 Tim Chase wrote:
>
>> On 2021-09-04 14:07, Andreas Perstinger wrote:
>> > Alternatively, without using an external command:
>> >
>> > :%s_^\[\(\d\+\)_\="[" . strftime("%c", submatch(1))_
>>
>> This is much better than the suggestion I gave, keeping it all
>> internal to vim. To clean it up, I'd tweak it to
>>
>> :%s/\[\zs\d\+\ze\]/\=strftime("%c", submatch(0))
Learning Vim is a never-ending experience: I didn't know (or remember)
about submatch()!
Can you explain why \zs... \ze is to be preferred to capturing with \(
and \)?
Thanks,
Life.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/sh0ep4%24q6g%241%40ciao.gmane.io.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment