Suppose that I have a file named filename123.txt and it is the single file that is named so, and I can locate it with the command locate filename123. And it returns only this file.
Now I want to open it with vi/vim. But I don't want to go to that location and type the vi command followed by filename. Here I want the result of locate filename123 to be appended to the vi command. How can I do so? I already tried:
locate filename123 | vi
But this does not works. And this error comes in terminal:
santosh@santosh:~$ locate filename123 | vi
Vim: Warning: Input is not from a terminal
Vim: Error reading input, exiting...
Vim: Finished.