On 19:15 Sun 04 Sep     , Chaoxu Tong wrote:
> Hi All,
> 
> I have a file containing file names like this:
> 
> a.txt
> b.dat
> e.cpp
> 
> I would like to invoke wc to count number of lines for these files, so i
> would like to use the current line or the select part(with visual mode) as
> my arugment.
> 
> So how could i do this in vim?
> 
> Thanks in advance.
> 
> -- 
> 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

Hi,

If you use gvim you can use this:
select the lines in with visual mode and run:
:'<,'>:g/.*/exe "!wc ".getline(".")
(assuming the files are in your current path, which you can check with ':pwd',
and adjust with ':cd' commands)

If you use vim (in terminal) a better solution is to use:
:'<,'>:g/.*/echo system("wc ".getline("."))

Best regards,
Marcin

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

Reply via email to