list textfile

Alexander Dalloz ad+lists at uni-x.org
Thu May 19 16:28:57 UTC 2005


Am Do, den 19.05.2005 schrieb roland brouwers um 17:57:

> 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

A different approach:

> list.txt
for i in $(ls -rt); do echo ${i} | cut -b1 | tr "\n" " " >> list.txt;
done

Alexander


-- 
Alexander Dalloz | Enger, Germany | GPG http://pgp.mit.edu 0xB366A773
legal statement: http://www.uni-x.org/legal.html
Fedora Core 2 GNU/Linux on Athlon with kernel 2.6.11-1.14_FC2smp 
Serendipity 18:17:55 up 5 days, 17:49, load average: 0.25, 0.14, 0.10 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20050519/6aa42ca2/attachment-0001.sig>


More information about the fedora-list mailing list