zsh-users
 help / color / mirror / code / Atom feed
From: Aaron Davies <aaron.davies@gmail.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: wc and leading spaces
Date: Mon, 22 Aug 2011 22:31:55 -0400	[thread overview]
Message-ID: <CACQi4XCUBJt1CEd1AGz=2_w33aBEhewFBi5FRV99cZTm=txw-w@mail.gmail.com> (raw)
In-Reply-To: <CADjGqHvYVmvqV+mF9Cdk6wbPoeq-n0pgSJQHwGm1xjaG1T_XVg@mail.gmail.com>

On Mon, Aug 22, 2011 at 7:53 PM, TJ Luoma <luomat@gmail.com> wrote:

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

one cheap way is to let zsh trim them off through word splitting rules

pro% wc foo
     175    1898   15898 foo
pro% echo $(wc foo)
175 1898 15898 foo

there's presumably something you can do with zsh pattern matching
(14.3 Parameter Expansion in the info manual)....
--
Aaron Davies
aaron.davies@gmail.com


      parent reply	other threads:[~2011-08-23  2:32 UTC|newest]

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

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='CACQi4XCUBJt1CEd1AGz=2_w33aBEhewFBi5FRV99cZTm=txw-w@mail.gmail.com' \
    --to=aaron.davies@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).