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 > http://www.gnu.org/software/coreutils/rejected_requests.html 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 thanks, Pádraig. p.s. Thanks for taking the time to read the previous requests and following the correct process.
