LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Output a list of five books with their filename titles into one file (https://www.linuxquestions.org/questions/linux-newbie-8/output-a-list-of-five-books-with-their-filename-titles-into-one-file-4175535027/)

xcislav 02-25-2015 12:38 AM

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!...(

veerain 02-25-2015 04:09 AM

Quote:

find . -type f | while read x; echo -e "\n$x";cat "$x";done > бетховен.txt
You can use sort.

Code:

find . -type f | while read x; echo -e "\n$x";cat "$x";done | sort -V > бетховен.txt


All times are GMT -5. The time now is 03:45 PM.