bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wc


From: iram chelli
Subject: Re: wc
Date: Fri, 12 Jun 2009 21:44:35 +0200
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

Bob Proulx a écrit :
Iram CHELLI wrote:
    wc FILE | cut -d " " -f 2

it usually works but sometimes wc outputs the result in a different formatting, that is, I have to do a cut -d " " -f 3 to get the wc.

The output format for the wc on different systems will produce a
differing number of leading spaces.  Counting on a particular number
of spaces isn't portable.  This is done to line up the columns to make
them more human readable.  Because of this 'cut' isn't the right tool
for the task.  Awk is a better fit.

  wc FILE | awk '{print$2}'

This is not very convenient that the wc program shall not return results in a fixed formatting.

But so it has been for decades.  It has been for too many years to
change it now.

Bob



Thank you Bob

I knew that one but I simply wondered why wc had that behavior.

Cheers,


Iram.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]