This is probably an easy one, but I can't figure it out and it's pretty much not searchable. In a folder hierarchy I have exactly one file of type xyz. I want to find that file and open it with a terminal command.
find . -name *.xyz
This will return the file I'm looking for. Now how do I open it automatically, without typing the name?
find . -name *xyz | open
This doesn't work. It says it doesn't found the open command.
@retracile is correct. You need to open it with 'something'. However, I prefer to use exec over xargs.
find . -name '*.xyz' -exec cat {} \;
this will return cat fileFound.xyz; cat fileFound2.xyx;
etc.. however, you are only expecting to find one file.
note that changing \;
to +
would return cat fileFound.xyz fileFound2.xyz
depending on case the later maybe the preferred choice.
for more on this I would direct you to this question
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments