sorting lines by two first virtual column

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

sorting lines by two first virtual column

Ni Va
Hi,

I would like to sort lines by order ascendant by the alphabetical value of the two first columns.

 2021/01/13 15:05:52.417 FOO
 2021/01/13 15:05:52.417 FOO
 2021/01/13 15:05:52.417 FOO
 2021/01/13 15:06:05.151 FOO
 2021/01/13 15:06:05.151 FOO
 2021/01/13 15:06:05.151 FOO
 2021/01/13 15:06:05.151 FOO
 2021/01/13 15:06:05.151 FOO
 2021/01/13 15:06:08.354 FOO
 2021/01/13 15:06:08.354 FOO
 2021/01/13 15:06:08.354 FOO
 2021/01/13 15:06:05.151 BAR
 2021/01/13 15:06:05.151 BAR
 2021/01/13 15:06:05.151 BAR
 2021/01/13 15:06:05.151 BAR
 2021/01/13 15:06:05.151 BAR
 2021/01/13 15:06:05.151 BAR
 2021/01/13 15:06:08.354 BAR
 2021/01/13 15:06:08.354 BAR
 2021/01/13 15:06:08.354 BAR



--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/fab10aa5-02db-468a-a2a7-e169333a6e2an%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: sorting lines by two first virtual column

rwmit...@gmail.com
This worked for me.  Put the cursor on the first line and type:
  !}sort

See the unix man page on sort for any additional options you may want to through at it.
The !  tells vim you want want process a block of text thru an external program
The } tells vim to send this paragraph
'sort' is the command to do the filtering/processing.

that's my basis understanding of what is happening.


On Saturday, January 30, 2021 at 3:41:51 AM UTC-5 [hidden email] wrote:
Hi,

I would like to sort lines by order ascendant by the alphabetical value of the two first columns.

 2021/01/13 15:05:52.417 FOO
 2021/01/13 15:05:52.417 FOO
 2021/01/13 15:05:52.417 FOO
 2021/01/13 15:06:05.151 FOO
 2021/01/13 15:06:05.151 FOO
 2021/01/13 15:06:05.151 FOO
 2021/01/13 15:06:05.151 FOO
 2021/01/13 15:06:05.151 FOO
 2021/01/13 15:06:08.354 FOO
 2021/01/13 15:06:08.354 FOO
 2021/01/13 15:06:08.354 FOO
 2021/01/13 15:06:05.151 BAR
 2021/01/13 15:06:05.151 BAR
 2021/01/13 15:06:05.151 BAR
 2021/01/13 15:06:05.151 BAR
 2021/01/13 15:06:05.151 BAR
 2021/01/13 15:06:05.151 BAR
 2021/01/13 15:06:08.354 BAR
 2021/01/13 15:06:08.354 BAR
 2021/01/13 15:06:08.354 BAR



--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/e8505926-0b07-4071-b02d-7485bba1e512n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: sorting lines by two first virtual column

arocker
In reply to this post by Ni Va

>
> I would like to sort lines by order ascendant by the alphabetical value of
> the two first columns.
>

Are you on Windoes, or an *nix?

(The example file would be more useful if the input was not in order.)

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/4a152c29510c7feb462a4dd53ca06f69.squirrel%40webmail.vybenetworks.com.
Reply | Threaded
Open this post in threaded view
|

Re: sorting lines by two first virtual column

rwmit...@gmail.com
The input isn't it order.  The lines ending in BAR should get intermixed with FOO.

On Saturday, January 30, 2021 at 11:25:56 AM UTC-5 [hidden email] wrote:

>
> I would like to sort lines by order ascendant by the alphabetical value of
> the two first columns.
>

Are you on Windoes, or an *nix?

(The example file would be more useful if the input was not in order.)

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/275566db-532a-4b5a-baf8-b23be32b99b1n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: sorting lines by two first virtual column

Ni Va
I have done that kind of sort from within Vim : sort /^.\{8}\zs.\{15}\ze/ r

But it ignores stamped date hour and not  two first columns >> then do the same job.

Le samedi 30 janvier 2021 à 19:27:41 UTC+1, [hidden email] a écrit :
The input isn't it order.  The lines ending in BAR should get intermixed with FOO.

On Saturday, January 30, 2021 at 11:25:56 AM UTC-5 [hidden email] wrote:

>
> I would like to sort lines by order ascendant by the alphabetical value of
> the two first columns.
>

Are you on Windoes, or an *nix?

(The example file would be more useful if the input was not in order.)

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/371e2f9b-4ef4-4d3b-8866-70514a405a44n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: sorting lines by two first virtual column

Ni Va
In reply to this post by arocker
Oh so Sorry. Windows 10.

Le sam. 30 janv. 2021 à 17:25, <[hidden email]> a écrit :

>
> I would like to sort lines by order ascendant by the alphabetical value of
> the two first columns.
>

Are you on Windoes, or an *nix?

(The example file would be more useful if the input was not in order.)

--
--
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 a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/jmelxbd3RV4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/4a152c29510c7feb462a4dd53ca06f69.squirrel%40webmail.vybenetworks.com.

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAOKxv4E9kAom_nzpmCRvdjix732udECb9xpOwkGGngxkeLyrSA%40mail.gmail.com.