特定の文字列を含むファイルをコピーする

$pwd;find . | sort | sed '1d;s/^\.//;s/\/\([^/]*\)$/|--\1/;s/\/[^/|]*/| /g'

/home/hoge/test/xargs

--output
--01.txt
--02.txt
--result

$grep "hoge" input/* | cut -d ":" -f 1 | xargs -I {} cp {} ./result/

$pwd;find . | sort | sed '1d;s/^\.//;s/\/\([^/]*\)$/|--\1/;s/\/[^/|]*/| /g'

/home/hoge/test/xargs

--output
--01.txt
--02.txt
--result
--02.txt

参考

bash - copy after grep in Linux - Stack Overflow
tree コマンドが無い環境で tree コマンドを実現 - Qiita