list textfile

Steven W. Orr steveo at syslang.net
Thu May 19 16:55:22 UTC 2005


On Thursday, May 19th 2005 at 17:57 +0200, quoth roland brouwers:

=>
=>roland brouwers wrote:
=>> Hello everybody,
=>> 
=>> Could someone tell me how I can 
=>> List all filenames in a directory, sorted by time 
=>> And then
=>> Copying each file in this order to one file line by line, each line
=>> preceded by the first character of the filename

Just do it all in bash

ls -rt | while read line
do
   while read file
   do
      echo "${line:0:1} $file"
   done < $line
done

Take the space out of the echo if you don't like it.

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net




More information about the fedora-list mailing list