I am trying to open multiple files in vim from the command line with this command. For some reason I am getting an erro as you will see below.
$ find . -name edit.html.erb \
| perl -pi -e 's/^..//' \
| perl -pi -e 's/\n$/ /' \
| vim
When I run it without “| vim” as in this command:
$ find . -name edit.html.erb \
| perl -pi -e 's/^..//' \
| perl -pi -e 's/\n$/ /'
And get this output:
addresses/edit.html.erb claims/edit.html.erb emails/edit.html.erb owners/edit.html.erb packages/edit.html.erb users/edit.html.erb vessels/edit.html.erb voyages/edit.html.erb %
I get an error that probably has something to do with that “%” mark at the end of the output.
Here is the output and error:
Vim: Warning: Input is not from a terminal
Vim: Error reading input, exiting...
Vim: preserving files...
Vim: Finished.
How can I fix this? Not sure which of the parts is causing the error since I’m a newb, but any help would be appreciated!
You are passing the contents of the files as keyboard input. I presume what you want to do is launch
vimwith the files open. I don’t knowvim, but that’s usually achieved by passing the file names as arguments.In bash, one would use:
(Removed the nonsense use of
-i.)Actually, changing the newlines to spaces is useless, and so is removing the leading
./, so all you need is: