Re: [mu TECH] wc : faster, more gnarly

From: Michele Andreoli (m.andreoli@tin.it)
Date: Sun Mar 19 2000 - 10:40:55 CET


On Sat, Mar 18, 2000 at 07:07:04PM -0500, Alfie Costa nicely wrote:
>
> 2) When binary files are the input, GNU 'wc' gives better numbers for counting
> words and lines. 'mu-wc' uses an awk routine to do this, and awk only seems to
> handle text correctly; so 'mu-wc' gives erroneous counts for binary files.
> Perhaps this doesn't need fixing, as nobody should want to do word counts on
> binary files. Still, it wouldn't be a bad thing to fix this, assuming there's
> an easy solution, such as a clever 'sed' script. Does anyone have such a 'sed'
> script?

sed do not work with binary files. Yes, "wc" is projected for text
files, do not worry about.

>
> # get list of char counts? Kludge to call 'ls' only once...
> [ "$c" ] && charlist=`ls -Uo "$@" | awk '{ printf "%s ", $4 }'`

My problem is: you use awk, here, but shell is enough

                set -- $string ; echo $4

In general, my policy is to do use only ash/sed/tr in script programming,
or a single awk script.

Michele

-- 
I'd like to conclude with a positive statement, but I can't 
remember any. Would two negative ones do?       -- Woody Allen
---------------------------------------------------------------------
To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.auc.dk
For additional commands, e-mail: mulinux-help@sunsite.auc.dk


This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:13 CET