Tuesday, July 8, 2014

Re: Clean string returned by windows console cmd

On 2014-07-08 09:00, Ni Va wrote:

> I obtain this string that I would like to clean :
>
> ^Af><fe>D^Ae^Av^Ai^Ac^Ae^AI^AD^A ^A ^A
> ^AC^A:^A ^A ^A ^A ^A ^A ^A ^A ^A
> ^AD^A:^A ^A ^A ^A ^A ^A ^A ^A ^A
> ^AE^A:^A ^A ^A ^A ^A ^A ^A ^A ^A
> ^AF^A:^A ^A ^A ^A ^A ^A ^A ^A ^A
> ^AG^A:^A ^A ^A ^A ^A ^A ^A ^A ^A
> ^AH^A:^A ^A ^A ^A ^A ^A ^A ^A ^A
> ^AI^A:^A ^A ^A ^A ^A ^A ^A ^A ^A
> ^AZ^A:^A ^A ^A ^A ^A ^A ^A ^A ^A
> ^A
>
> This is obtained by launching this command :
> echo system("wmic logicaldisk get deviceid")
>
> I would like to get a list of drives on windows seven :
>
> C:, D: etc..

While shooting from the hip, my first thought would be to do
something like

echo substitute(system("wmic logicaldisk get deviceid"),
'[:cntrl:]\+', '', 'g')

which should get rid of most of the rubbish.

-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: