[Top][All Lists]

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

Feature request: uniq - Adding regex option to consolidate lines ?

From: Javier Barroso
Subject: Feature request: uniq - Adding regex option to consolidate lines ?
Date: Mon, 14 Oct 2013 08:56:02 +0200


Currently uniq can distinguish lines with several criterial (-f, -i,
-s, -w ). Maybe another criteria could be added (-r / --regex?)

The idea is consider a line which match with regex (being regex the
argument passed to "-r" option) duplicate of another line that matches
with that regex too.

For the moment I only have a perl script which made that task
("uniqregex regex" would be the sypnosis) (only for show you what I am

#!/usr/bin/perl -w
use strict;

my $regex=$ARGV[0];
my $count=0;
# Read stdin or ARGV[1] into the implicit variable
while (<>)
    if (/$regex/)
    if ($count < 2)

I see you have regex code in nl program, so maybe adding it to uniq is
not a bad idea.

The first use I gave to that script is to consolidate java exception,
where a large number of "[[:space:]]*at"  instances appear after than
the error message. So I can tail catalina.out (from tomcat) and read
error messages

I am refering to:

java.lang.NumberFormatException: 12
        at java.lang.Integer.parseInt(Compiled Code)
        at java.lang.Integer.parseInt(
        at excepcion.ExcepcionApp.main(


reply via email to

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