On 2013-08-20 09:16, tjg wrote:
> Date NbCar NbWords NbSent NbLines
> 130813 21910 3640 310 180
> 130820 30310 5210 480 220
> This function works. But I would like to add 2 "columns" :
>
> - one about the final output : divide the NbCar by 1500 (in France a
> journalistic "feuillet"/page, I do not know if there is an
> equivalent elsewhere) ; here it would indicate that a week ago I
> had written 15 feuillets (rounded upwards), and this week, 20
> feuillets : a 250 pages book in a year, "In search of lost time"
> much later, genius not included…
>
> - one about simple readability : divide the number of words by the
> number of sentences.
You could run something like this over the range of applicable lines:
:'<,'>s@^\d\{6\}\s\+\(\d\+\)\s\+\(\d\+\)\s\+\(\d\+\)\s\+\(\d\+\)\zs.*@\="\t".(submatch(1)/1500)."\t".(submatch(2)/submatch(3))
captures \date_/ \NbCar_/ \NbWord/ \NbSent/ \NbLine/
It separates the two new columns with tab characters, but you can
tweak the "\t"s to be whatever you need.
Note that Vim only deals in integers by default, so you might either
want to multiply the numerators by a fixed amount (such as 100) for
greater precision, or convert the various part to floats using the
"str2float()" function.
-tim
--
--
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/groups/opt_out.
Tuesday, August 20, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment