zsh-users
 help / color / mirror / code / Atom feed
* wc and leading spaces
@ 2011-08-22 23:53 TJ Luoma
  2011-08-23  0:21 ` Vincent Lefevre
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: TJ Luoma @ 2011-08-22 23:53 UTC (permalink / raw)
  To: Zsh Users

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…


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-08-23  2:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-22 23:53 wc and leading spaces TJ Luoma
2011-08-23  0:21 ` Vincent Lefevre
2011-08-23  0:24 ` Vincent Lefevre
2011-08-23  1:37 ` Benjamin R. Haskell
2011-08-23  2:31 ` Aaron Davies

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).