On 05/20/2010 02:34 PM, Paolo Bonzini wrote:
>>>> +but works with @code{grep -c '^'}. Another alternative for counting
>>>> +lines is to use @code{wc -l}.
>>>
>>> I think the most portable way to count lines is "sed -n '$='".
>>
>> Is there a decided advantage over 'wc -l' such as allowed maximum or so?
>
> No, but wc is not including in the GNU coding standards' list of
> portable utilities for configure/make.Good point. I'll push this patch shortly: diff --git i/ChangeLog w/ChangeLog index f7f50e9..fc0c3cc 100644 --- i/ChangeLog +++ w/ChangeLog @@ -1,3 +1,10 @@ +2010-05-20 Eric Blake <[email protected]> + + Mention another line-counting alternative. + * doc/autoconf.texi (Limitations of Usual Tools) <grep>: Mention + how to use sed to count lines. + Suggested by Paolo Bonzini. + 2010-02-25 Eric Blake <[email protected]> Properly quote AC_PREREQ during autoupdate. diff --git i/doc/autoconf.texi w/doc/autoconf.texi index 51fe0f4..1c85191 100644 --- i/doc/autoconf.texi +++ w/doc/autoconf.texi @@ -17869,8 +17869,8 @@ Limitations of Usual Tools status of @code{grep} to determine whether it found a match. The QNX4 implementation fails to count lines with @code{grep -c '$'}, -but works with @code{grep -c '^'}. Another alternative for counting -lines is to use @code{wc -l}. +but works with @code{grep -c '^'}. Other alternatives for counting +lines are to use @code{sed -n '$='} or @code{wc -l}. Some traditional @command{grep} implementations do not work on long input lines. On AIX the default @code{grep} silently truncates long -- Eric Blake [email protected] +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
