Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

wc and leading spaces



Can anyone explain why 'wc' adds leading spaces to its output? ^1

for example:

$ ls | wc -l | sed 's# #~#g'
~~~~1299

or in another dir:

$ ls | wc -l | sed 's# #~#g'
~~~~~~47

I don't understand why:

a) anyone would want leading spaces

b) why they add enough spaces so that the numbers are "right"
justified (that might not be the proper term, but you get the idea)


Zsh question: Is there a way to get rid of the spaces without using
either "| awk '{print $1}'" or "| sed 's#^ *##g'"?

TjL

^1 — well, GNU's 'wc' does not seem to add leading spaces, but my
standard 'wc' in Mac OS X does…



Messages sorted by: Reverse Date, Date, Thread, Author