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

Re: wc and leading spaces



On Mon, Aug 22, 2011 at 7:53 PM, TJ Luoma <luomat@xxxxxxxxx> 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@xxxxxxxxx



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