[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Document the grep workaround.
From: |
Eric Blake |
Subject: |
Re: [PATCH] Document the grep workaround. |
Date: |
Thu, 20 May 2010 15:06:55 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b1 Mnenhy/0.8.2 Thunderbird/3.0.4 |
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 <address@hidden>
+
+ 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 <address@hidden>
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 address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature