Open file found with 'find' command

DrummerB

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.

matchew

@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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Open file found with 'find' command

From Dev

How to find the executable file for "open" command in Mac?

From Dev

How to find the executable file for "open" command in Mac?

From Dev

"Cannot find or open the PDB file" of a class library found in another solution

From Dev

How to open a found file with vi? Piping 'find' output to vi

From Dev

Is there a way to show "File not found" or a message alike when using the `find` command?

From Dev

Running a Bash function for each file found with the find command

From Dev

How to get absolute path of found file using 'find' command in Linux?

From Dev

`open` command to open a file in an application

From Dev

bash: file: command not found

From Dev

How to open a *.xlsx file containing a space in file name found by command DIR in Excel?

From Dev

Count lines found with find command

From Dev

Yum, Rpm and Find Command Not Found

From Dev

Mac Terminal Find and Open command

From Dev

Mac Terminal Find and Open command

From Dev

Declare not found and cannot open =: No such file

From Dev

OSX 10.10.3 zsh: command not found: open

From Dev

-bash: 400:: command not found when open terminal

From Dev

The file specified for :r command was not found

From Dev

Command Prompt: java file not found

From Dev

Execute a command where a file is found

From Dev

Where is the echo command file found

From Dev

Install sh file command not found

From Dev

system command to open a file in r

From Dev

Create and open file with one command?

From Dev

bash: cannot open file with command

From Dev

system command to open a file in r

From Dev

How can I find out the command line corresponding to choosing an application to open a file in desktop environment?

From Dev

android FileWriter cannot open file ( file not found)

Related Related

  1. 1

    Open file found with 'find' command

  2. 2

    How to find the executable file for "open" command in Mac?

  3. 3

    How to find the executable file for "open" command in Mac?

  4. 4

    "Cannot find or open the PDB file" of a class library found in another solution

  5. 5

    How to open a found file with vi? Piping 'find' output to vi

  6. 6

    Is there a way to show "File not found" or a message alike when using the `find` command?

  7. 7

    Running a Bash function for each file found with the find command

  8. 8

    How to get absolute path of found file using 'find' command in Linux?

  9. 9

    `open` command to open a file in an application

  10. 10

    bash: file: command not found

  11. 11

    How to open a *.xlsx file containing a space in file name found by command DIR in Excel?

  12. 12

    Count lines found with find command

  13. 13

    Yum, Rpm and Find Command Not Found

  14. 14

    Mac Terminal Find and Open command

  15. 15

    Mac Terminal Find and Open command

  16. 16

    Declare not found and cannot open =: No such file

  17. 17

    OSX 10.10.3 zsh: command not found: open

  18. 18

    -bash: 400:: command not found when open terminal

  19. 19

    The file specified for :r command was not found

  20. 20

    Command Prompt: java file not found

  21. 21

    Execute a command where a file is found

  22. 22

    Where is the echo command file found

  23. 23

    Install sh file command not found

  24. 24

    system command to open a file in r

  25. 25

    Create and open file with one command?

  26. 26

    bash: cannot open file with command

  27. 27

    system command to open a file in r

  28. 28

    How can I find out the command line corresponding to choosing an application to open a file in desktop environment?

  29. 29

    android FileWriter cannot open file ( file not found)

HotTag

Archive