Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#503304: 'wc' should have a recursive option

31 views
Skip to first unread message

Daniel Watkins

unread,
Oct 24, 2008, 11:00:34 AM10/24/08
to
Package: coreutils
Version: 6.10-6
Severity: wishlist

It'd be nice if I could pass '-r' to wc, rather than using ridiculous shell
expansions.

-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.24-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages coreutils depends on:
ii libacl1 2.2.47-2 Access control list shared library
ii libc6 2.7-15 GNU C Library: Shared libraries
ii libselinux1 2.0.65-5 SELinux shared libraries

coreutils recommends no packages.

coreutils suggests no packages.

-- no debconf information

--
To UNSUBSCRIBE, email to debian-bugs-...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Bob Proulx

unread,
Oct 24, 2008, 5:00:13 PM10/24/08
to
Daniel Watkins wrote:
> Severity: wishlist
>
> It'd be nice if I could pass '-r' to wc, rather than using ridiculous shell
> expansions.

-1

Try this instead:

find . -type f -print0 | wc --files0-from=-

If you have a specific need that is often repeated then making a shell
script, function or alias to encapsulate this into a shorter typed
command might be useful.

I would like to file a wishlist that -r be removed from grep which
added it recently. Really! It has been a source of a very long list
of bugs in that program.

Seriously there isn't a need for *every utility* to add directory
traversal (file finding) routines. It isn't needed and it creates
bloated and bug prone code. It violates the spirit of the Unix
philosophy.

For example it isn't simply -r,--recursive. Once that is added then
--exclude, --exclude-from, --exclude-dir and --include, special rules
for file names "**" and 'skip', 'read', and 'devices' and all rest of
the framework that is needed to support it. It isn't small. It isn't
simple. It can't be implemented uniformly. Most importantly it both
isn't needed and isn't desired.

Instead please learn to use 'find' for directory traversal. It works
generically with the entire set of file operation utilities. It is a
very useful for more programs than simply 'wc'. Being able to use
'find' makes one much more powerful and productive.

Useful Resources:

http://www.faqs.org/docs/artu/ch01s06.html

info coreutils 'wc invocation'

Bob

0 new messages