How to pipe list of files returned by find command to cat to view all the files

后端 未结 15 1458
庸人自扰
庸人自扰 2020-12-02 03:44

I am doing a find and then getting a list of files. How do I pipe it to another utility like cat (so that cat displays the contents of all those fi

15条回答
  •  天涯浪人
    2020-12-02 04:02

    To achieve this (using bash) I would do as follows:

    cat $(find . -name '*.foo')
    

    This is known as the "command substitution" and it strips line feed by default which is really convinient !

    more infos here

提交回复
热议问题