Re: Feed a list of filenames to vim

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Wednesday 18 May 2011 16:06:47 Bowie Bailey wrote:
> > or, if you need recursive:
> >   $ eval vim $(find /some/dir -type f -printf '"%p" ')
> > 
> > (shell quotes expansions automatically, but you can still ensure output
> > from find is appropriately quoted manually)
> 
> Interesting.  I'm not sure what the eval is doing, but it works even
> with spaces in the filenames.  Unfortunately, it won't work with the
> OP's original scenario (a file with a list of filenames to edit).

eval just evaluates arguments and hence does the same argument splitting as 
shell does when it receives a command, you can see it if you do 'set -x' 
before running the command.  In this case eval gets two arguments: 'vim' and 
'"/some/dir/a" "/some/dir/b" ', after splitting the command run is vim 
"/some/dir/a" "/some/dir/b" (quoted) which is why spaces, etc. are preserved.

As for OP's original scenario, I left it out as you already answered it.  Note 
that there's also a shortcut for cat (without launching a subprocess):

  $ vim $(< listfile)


-- 
Michael Gliwinski
Henderson Group Information Services
9-11 Hightown Avenue, Newtownabby, BT36 4RT
Phone: 028 9034 3319

**********************************************************************************************
The information in this email is confidential and may be legally privileged.  It is intended solely for the addressee and access to the email by anyone else is unauthorised.
If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.
When addressed to our clients, any opinions or advice contained in this e-mail are subject to the terms and conditions expressed  in the governing client engagement leter or contract.
If you have received this email in error please notify support@xxxxxxxxxxxxxxxxxxx

John Henderson (Holdings) Ltd
Registered office: 9 Hightown Avenue, Mallusk, County Antrim, Northern Ireland, BT36 4RT.
Registered in Northern Ireland
Registration Number NI010588
Vat No.: 814 6399 12
*********************************************************************************

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux