2

I'm trying to save some work by editing multiple files with the same name located in different directories:

$ mkdir -p directory_{0..10}/results

How may I create files with the same name in all directories. For example,

$ vim/kwrite directory_*/results/output.txt
2
  • are you trying to open them for editing or just create them? What you have there will work for editing with vim if the files exist: vim directory_*/results/output.txt Jul 3, 2015 at 16:35
  • I would also like to edit them.
    – Sebi
    Jul 3, 2015 at 16:45

1 Answer 1

4

You almost have it with your second command. You did it correctly with the first, just use the same shell sequence expansion:

vim directory_{0..10}/results/output.txt

You should see something in the shell about opening 11 files. Then you can use vim to iterate through each one.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .