zsh-users
 help / color / mirror / code / Atom feed
From: TJ Luoma <luomat@gmail.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: wc and leading spaces
Date: Mon, 22 Aug 2011 19:53:38 -0400	[thread overview]
Message-ID: <CADjGqHvYVmvqV+mF9Cdk6wbPoeq-n0pgSJQHwGm1xjaG1T_XVg@mail.gmail.com> (raw)

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…


             reply	other threads:[~2011-08-22 23:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22 23:53 TJ Luoma [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADjGqHvYVmvqV+mF9Cdk6wbPoeq-n0pgSJQHwGm1xjaG1T_XVg@mail.gmail.com \
    --to=luomat@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).