LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Why does each filename from ls have a newline?

[ILUG] Why does each filename from ls have a newline?

Dermot McGahon dermot.mcgahon at tradesignals.com
Tue Dec 19 10:46:40 GMT 2000


This behaviour is great because you can pipe output from ls to other
commands and it works like you would expect, for example:

ls -R | egrep -v ".*:" | egrep -v "^$" | mawk '{ printf "mv %s %s\n",
$0, tolower($0) }'

but I don't understand why the output is presented column across using
bash and an xterm, when there are embedded newlines? How does this
work?

Also there is a -1 option to ls so that it gives one filename per line
but specifying the -1 option or leaving it out won't make any
difference to how the above pipeline will work. So, do any of you use
the -1 option and what do you use it for.

And finally, are there are better ways to convert filenames from
uppercase to lowercase? The other that I know of is find -exec tr. Are
there more?

Dermot.
--

dmcgahon at dnrc:~/xmlrpc$ ls | tr "\n" "|"
ChangeLog|agesort.php|base64test.php|bettydemo.php|booltest.php|client.php|demo1.txt|demo2.txt|demo3.txt|doc|httptest.php|introspect.php|introspect_demo.php|mail.php|server.php|stringtest.php|test.pl|test.py|vardemo.php|workspace.testPhpServer.fttb|xmlrpc.inc|xmlrpcs.inc|zopetest.php|dmcgahon at dnrc:~/xmlrpc$

dmcgahon at dnrc:~/xmlrpc$ ls -R | tr "\n" "|"
.:|ChangeLog|agesort.php|base64test.php|bettydemo.php|booltest.php|client.php|demo1.txt|demo2.txt|demo3.txt|doc|httptest.php|introspect.php|introspect_demo.php|mail.php|server.php|stringtest.php|test.pl|test.py|vardemo.php|workspace.testPhpServer.fttb|xmlrpc.inc|xmlrpcs.inc|zopetest.php||./doc:|Makefile|apidocs.html|arrayuse.html|bugs.html|custom.dsl|debugging.html|examples.html|helpers.html|index.html|introduction.html|manifest.html|reserved.html|support.html|sysmethhelp.html|sysmethodsig.html|xmlrpc-server.html|xmlrpc_php.sgml|xmlrpcmsg.html|xmlrpcresp.html|xmlrpcval.html|dmcgahon at dnrc:~/xmlrpc$







More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell