RE: list textfile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

That's a one-liner:

$ awk '{ print substr(FILENAME, 1, 1) $0 }' $(ls -rt) > /path/to/output

If you actually want to see the list of files, as suggested by the way 
you worded the request, use:

$ ls -1rt

Paul.

=========================
Dear Paul,

This line
$ awk '{ print substr(FILENAME, 1, 1) $0 }' $(ls -rt) > /path/to/output

puts the first char of filename on a separated line.
How do I remove this linefeed, like echo -n does, so both will appear on
the same line?

This will generate a linux textfile, I suppose. Is there a way of
turning it into a Windows file with CrLf without using unix2dos?

Thanks again
Roland






[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux