LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-25-2015, 01:38 AM   #1
xcislav
LQ Newbie
 
Registered: Feb 2011
Location: Kiev, Ukraine
Posts: 25

Rep: Reputation: 0
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!...(

Last edited by xcislav; 02-25-2015 at 01:49 AM.
 
Old 02-25-2015, 05:09 AM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
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
 
  


Reply

Tags
file, linux, regex


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Sort Titles (like books, movies, etc.)? ezekieldas Programming 10 02-19-2012 09:17 AM
[SOLVED] Add filename to file output sarenace Programming 4 02-06-2012 05:34 PM
[SOLVED] Sed – how do I save output to file with filename from content of another file? misarab Programming 4 02-28-2011 03:12 PM
converting file encoding (batch files) with same output filename yuubouna Linux - Newbie 1 01-14-2007 09:32 PM
XMMS brakes titles if filename contains spaces? deftone` Linux - Software 0 01-13-2007 06:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration