Output a list of five books with their filename titles into one file

Dear forum of Linux,
could I output a list of five books with their filename titles into one file?
In order o output all the contents of all the files with their filenames there was: find . -type f | while read x; echo -e “\n$x”;cat “$x”;done > бетховен.txt

In spite of them being successively named 1Atitle… 2Atitle the two first aren’t 1A 2A, but 1A …5A (2
3 4) They actually are: 1АБетховен… 5АБетховен… It now breaks all things I hoped.

Could the task be done by head, cat or grep command? Cat has no filename parameter, head can’t output the whole file and grep has a filename parameter but it’s primary use is searching one line. In find I coulnd’t write each file by hand …

i’ve got another command awk ‘{ print FILENAME, $0 }’ (it claims to show the filename though it shows it didn’t end

Currently I blame the Linux learning curve because of google results and non-answered messages and all that after translation if a nice question directly to English. Isn’t that it hard to make more help to design unixes language in that way to be really descriptive and write it as you think.
I’m deeply sorry for that grief!..(


bash is easier than csh, think yourself lucky! You could try using Python, the syntax is easier but it’s a lot more complicated to interact with the filesystem. I think a lot of the complexity comes from “regular expression syntax”, but that’s universal - you’ve just gotta live with it.

Sidenote - is this homework?

If I’m understanding you correctly (and I’m probably not) … how about:

find . -type f -printf "\n--> %f <--\n" -exec cat {} \; > ~/бетховен.txt

(do not output to the same directory you’re running find in)