NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/57252: wc
The following reply was made to PR bin/57252; it has been noted by GNATS.
From: RVP <rvp%SDF.ORG@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: bin/57252: wc
Date: Thu, 2 Mar 2023 11:03:24 +0000 (UTC)
On Thu, 2 Mar 2023, Marc Daniel Fege wrote:
> cat /etc/hosts | wc -w
>
> produces a more clean output what I mean. I just saw after I checked the=20
> output with an editor that there are just plain space characters and no tab=
> s=20
> and also adds unneccessary empty spaces in advance of that output. Kind of=
> =20
> odd.
>
Well, those extra spaces are annoying, but, you can get rid of them
pretty easily like this:
$ x=$(x=$(wc -l < /etc/motd); echo $x)
$ echo "$x"
8
$
And, SUSv4 2018 actually recommends a single space instead of tabs:
```
STDOUT
By default, the standard output shall contain an entry for each
input file of the form:
"%d %d %d %s\n", <newlines>, <words>, <bytes>, <file>
```
And,
```
RATIONALE
The output file format pseudo- printf() string differs from the
System V version of wc:
"%7d%7d%7d %s\n"
which produces possibly ambiguous and unparsable results for very
large files, as it assumes no number shall exceed six digits.
```
-RVP
Home |
Main Index |
Thread Index |
Old Index