Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a file 'filelist' that contains the following lines:


I am looking for a command line invocation that opens the 3 files in vim. I tried the following:

$ cat filelist | vim - 


$ vim < cat filelist

but those do not yield the desired result.

share|improve this question
Try vim $(cat filelist). – vonbrand Apr 12 '13 at 14:01

If the file names don't contain spaces or other problematic characters, you can use

vim $(cat filelist)

For file names with spaces, using xargs is more robust (here using GNU xargs specific options):

xargs --delimiter '\n' --arg-file=filelist vim --
share|improve this answer
What a quick answer! Great :) I found another solution on this site using backticks (on the same key as the ~ sign). Here it is: unix.stackexchange.com/a/5882/37057 – user37057 Apr 12 '13 at 13:52
$(…) is the same as backticks, but a little more robust, since they can't be confused with single quotes or other similar looking characters and they can be nested. – Marco Apr 12 '13 at 13:54
The xargs one affects the stdin of vim. – Stéphane Chazelas Apr 12 '13 at 15:03

With zsh:

vim -- "${(f)$(<filelist)}"

With any Bourne-like shell (including zsh):

'; set -f; exec vim -- `cat filelist`)

With GNU xargs:

xargs -d '\n' --arg-file=filelist vim --
share|improve this answer

To open all index.php in the current working path

vim -p `find . -name index.php`
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.