Wednesday, December 14, 2016

Re: How can I do date format convertion?

On 14 December 2016, Carfield Yim <carfield@gmail.com> wrote:
> Hi, I have a list of date like
>
> 20150204
> 20150304
> 20150309
> 20150323
> 20150331
> 20150416
> 20150608
>
> I would like to change it to
>
> 2015.02.04
> 2015.03.04
> 2015.03.09
> 2015.03.23
> 2015.03.31
> 2015.04.16
> 2015.06.08
>
> How can I do that?

There are many ways to do it, here's two of them:

:%s/\d\{4}\zs\d\d\ze\d\d/.&.

:g/\d\{8}/ s/\%7c\zs\ze/./ | s/\%5c\zs\ze/./

/lcd

--
--
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.
For more options, visit https://groups.google.com/d/optout.

No comments: