複数ファイルをファイル名付きでcatで出力(ワンライナー)

ただのメモ
inの後ろをfindとかにしてもOK

 for filename in `ls /usr/local/src/*`; do echo "########## $filename ##########" && cat $filename; done
########## /usr/local/src/a.txt ##########
file a dayo
########## /usr/local/src/b.txt ##########
file b dayo
########## /usr/local/src/c.txt ##########
file c dayo

Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account log in.