Combine two commands

Discussion in 'Programming/Scripts' started by MikeID, May 3, 2016.

  1. MikeID

    MikeID New Member

    I am trying to find files recursively from a directory down, but only in directories ending in a particular string. I can find the directories this way "find . -type d -iname '*.something.else'". I would like to search each of these directories for files also with a particular string in the name. I can find the files with this command "find . -type f -iname '*.exd.*'". The file finding command works for what I need it to do but I would like to speed it up by it only searching the more specific directories. How would I combine these commands? It would also be nice to display the file name and path.
  2. sjau

    sjau Local Meanie Moderator

    -ipath "*xxx/*"
  3. MikeID

    MikeID New Member

    find . -ipath "*.something.else/*" -type f -iname '*.exd.*
    worked for me. Would it be possible to pipe each file that this finds into a grep etc command to search for a particular string in that file?
  4. sjau

    sjau Local Meanie Moderator

  5. mariaczi

    mariaczi New Member

    or you can use "--exec" option in find syntax ;)
  6. nguoiduatin196

    nguoiduatin196 New Member

    find . -ipath "*.something.else/*" -type f -iname '*.exd.* or you can use "--exec" option in find syntax

Share This Page