Taking on the challenge listed here
https://dev.to/jorinvo/csv-challenge-1al
it provides a .json file link to mung into date-named files (never
mind that these happen to all be the same date), I came up with this
vim solution:
:g/.*name":"\([^"]*\)".*card":"\([^"]*\)".*/let
s=substitute(getline('.'), '.*stamp":"\(\d\+\)-\(\d\+\)-\(\d\+\).*',
'\1\2\3','').'.txt'|s//\1,\2/|exec ".w!>>".s
which works. But for some reason, it is *painfully* slow on my
machine. The basic intent is that it identifies rows with a (fake)
credit-card number, snapshots the YYYYMMMDD.txt filename, then turns
the row into a CSV entry ("name, CC"), and writes (appending) that one
line into the output filename.
The whole thing should happen in a blink. Maybe a second at worst.
But this was walk-away-do-something-and-come-back slow.
If I change the "exec" to an "echo", it's as fast as I expect.
Any idea what might be making the exec so slow?
-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/d/optout.
No comments:
Post a Comment