[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New feature for 'wc': Filter lines by character count
From: |
Eric Blake |
Subject: |
Re: New feature for 'wc': Filter lines by character count |
Date: |
Thu, 03 Apr 2014 09:13:35 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
On 04/03/2014 08:51 AM, Pádraig Brady wrote:
> While wc would be a place to add it if we were going to integrate this,
> I'm thinking the functionality is a bit too specialized to add.
> Existing tools can do this adequately I think. Consider:
>
> awk 'length($0) != 140' < log.txt | wc -l
Or even shorter:
grep -vc '^.\{140\}$' log.txt
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature