Linux: cat with separators among files

In Linux if you type cat *, you will get something like this:

line1 from file1
line2 from file1
line1 from file2
line1 from file3
line2 from file3
line3 from file3

What I would like is to display a separator among files. Something like this:
line1 from file1
line2 from file1
XXXXXXXXXXXX
line1 from file2
XXXXXXXXXXXX
line1 from file3
line2 from file3
line3 from file3

Is that easily possible with a one-liner easy to type by heart?


If you're not too fussy about the appearance of the separator:

tail -n +1 *

cd /to/your/directory; for each in *; do cat $each; echo "XXXXXXXXXXX"; done


awk 'FNR==1 && NR!=1 {print "XXXXXXXXXXXX"}{print}' *

Or

awk 'FNR==1 {print "XXXXXX", FILENAME, "XXXXXX"}{print}' *

Or

awk 'FNR==1 {print "XXXXXX File no. " ++count, "XXXXXX"}{print}' *

Using only Bash (no cat):

for file in *; do printf "$(<"$file")\nXXXXXXXXXXXX\n"; done

Edit:

In AWK 4:

awk 'BEGINFILE {print "XXXXXXXXXXXX"}{print}' *

You can use any separator such as the ones in the other examples in this answer. If you want the separator at the end of each file, change BEGINFILE to ENDFILE. It can still appear at the beginning of the script since it's a conditional (rather than implying execution order)..