[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Suppress filenames in wc output
From: |
Eric Blake |
Subject: |
Re: Suppress filenames in wc output |
Date: |
Tue, 11 Feb 2014 13:30:21 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
On 02/11/2014 01:26 PM, Thomas Bohm wrote:
> Hey,
>
> By playing with a word list today I noticed I can't compute the number of
> average letters / word by simply doing a calc `wc -m file`/`wc -l file`
> because the filename is part of the output if wc is run on a file (on stdin
> it is suppressed). This is why I added a new flag -q so that a user can
> suppress that part of the output I will. I don't have high hopes of it
> getting accepted, but I said I try :)
Thanks for the suggestion, but this already does what you want:
calc `wc -m < file`/`wc -l < file`
That is, POSIX requires that when reading from stdin rather than from a
filename, then there will be no filename in the output of wc. As this
is already a standard way to suppress the output, I see no need to add a -q.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature