$ for i in agreements other; do for j in `ls $i`; do echo "*** $i/$j ***"; cat $i/$j; done; done *** agreements/abc.txt *** ... ABC Union ... *** agreements/abc_xyz.pdf *** ... XYZ Union and ABC Union ... *** agreements/def.txt *** ... DEF Union ... *** agreements/pqrpdf *** ... temp data ... *** agreements/xyz.pdf *** .................. XYZ Union ............. *** other/dummy_empty ***