[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New feature for 'wc': Filter lines by character count

From: Pádraig Brady
Subject: Re: New feature for 'wc': Filter lines by character count
Date: Thu, 03 Apr 2014 15:51:56 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 04/03/2014 03:29 PM, SAeeD wrote:
> Hello,
> I was parsing a log file some days ago, and it had about 1,600,000 lines. All 
> lines in that log file were supposed to have a fix length of say, 140 
> characters. Because of some noises on RS232 cable, some lines had fewer or 
> much characters than 140.
> I was thinking of a program that let me knew how many lines have more/less 
> characters than specified (here 140). I wrote a simple program for my purpose 
> but I thought it is better to integrate this feature in a well-know 
> frequently used tool like 'wc'.
> So, the usage would be something like:
> $ cat log.txt | wc --more-chars-than 140
> 9 (for instance)
> $ cat log.txt | wc --less-chars-than 140
> 11 (for instance)
> Filtering lines by number of word can also be added.
> I read the rejected features for coreutils at 
> and there was no 
> feature request alike this one. I also searched the mailing list archive and 
> did not find any discussion similiar.
> What's your opinion about this feature?
> I'm also volunteer and interested to implement it, if accepted.
> Thanks,
> SAeeD Ehteshamifar

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


p.s. Thanks for taking the time to read the
previous requests and following the correct process.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]