Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Piping find to find

Tags:

bash

pipe

I want to pipe a find result to a new find. What I have is:

find . -iname "2010-06*" -maxdepth 1 -type d | xargs -0 find '{}' -iname "*.jpg"

Expected result: Second find receives a list of folders starting with 2010-06, second find returns a list of jpg's contained within those folders.

Actual result: "find: ./2010-06 New York\n: unknown option"

Oh darn. I have a feeling it concerns the format of the output that the second find receives as input, but my only idea was to suffix -print0 to first find, with no change whatsoever.

Any ideas?

like image 548
Harold Smith Avatar asked Apr 24 '11 23:04

Harold Smith


People also ask

How do you identify pipes in plumbing?

The connections between elements is a way for engineers to identify a particular pipe in a standardized way. And different color indicates different pipes to avoide confusion. Adding a single horizontal bar across any of the four graphical elements indicates the function resides in the primary location category.

How to read piping and instrumentation diagrams?

Part 2: How to Read Piping and Instrumentation Diagrams 1 Identify and Understand Standard Equipment -Instruments 2 Learn to Use Graphical Elements and Connecting Lines 3 Know the Letter and Number Combinations of a P&ID

What is the use of pipe in Linux?

A pipe in Linux is just a vertical bar on your keyboard. It is used to consider the command that is on the left side of it as an input to the command on the right side of it. Now that we know about both the find command the pipe in Linux, let’s consider an example where we will make use of both of these in a Linux command.

What are the types of lines used in a P&ID?

Given below are the types of lines used in a P&ID. No line: A simple circle indicates that the device is in the field and is a locally mounted instrument. The device is observable in the field and is accessed by the operator. Solid Line: A solid line in the center signifies that the instrument is placed in a primary location in the control room.


1 Answers

Useless use of xargs.

find 2010-06* -iname "*.jpg"

At least Gnu-find accepts multiple paths to search in. -maxdepth and type -d is implicitly assumed.

like image 84
user unknown Avatar answered Oct 06 '22 10:10

user unknown