}
my $float = qr<[0-9]* [.]? [0-9]+ (?: e[+-]?[0-9]+ )?>; # positive numberish
-my $valmatch = qr< $opt{anchor} ( \h* -? $float |) >x;
+my $valmatch = qr< $opt{anchor} ( \h* -? $float |) >;
while (defined ($_ = $opt{input} ? shift @{ $opt{input} } : readline)) {
s/\r?\n\z//;
if ($opt{count}) {
- my ($valnum) = m/(\S*)/;
+ my ($valnum) = m/$opt{anchor} (\S*)/;
$valnum //= '';
$uniq{$valnum}++ and next;
push @lines, "\n " . $_;
Number of HTTP requests per day:
- cat httpd/access.log | cut -d\ -f4 | cut -d: -f1 | uniq -c | barcat
+ barcat -cf'\[([^:]+)' httpd/access.log
Any kind of database query results, preserving returned alignment:
--- /dev/null
+prefix 1 1
+random 2 2
+prefix 3 1
+text 1 2
+prefix 2 1
+prefix 3 2
+prefix 1 1
+prefix 2 2
+prefix 3 0
+prefix 1 2
+prefix 2
+prefix 3 2
--- /dev/null
+barcat -c input/duplicolumns.txt
+10 prefix 1 1 -+-------=--->------------
+ 1 random 2 2 -+-
+ 1 text 1 2 -+-
--- /dev/null
+barcat -c -f+0 input/duplicolumns.txt
+4 prefix 1 1 --------------------------+
+4 random 2 2 --------------------------+
+4 prefix 3 1 --------------------------+
--- /dev/null
+barcat -c -f2 input/duplicolumns.txt
+4 prefix 1 1 ---<------+-=-----
+6 random 2 2 ---<------+-=-------->-----
+1 prefix 3 0 ---<-
+1 prefix 2 ---<-
--- /dev/null
+barcat -c -f'\S\K(.*)' input/duplicolumns.txt
+2 prefix 1 1 ------------+--=-----------
+1 random 2 2 ------------+-
+1 prefix 3 1 ------------+-
+1 text 1 2 ------------+-
+1 prefix 2 1 ------------+-
+2 prefix 3 2 ------------+--=-----------
+1 prefix 2 2 ------------+-
+1 prefix 3 0 ------------+-
+1 prefix 1 2 ------------+-
+1 prefix 2 ------------+-
--- /dev/null
+barcat -c -f'(e.)' input/duplicates.txt
+17 thrice --+------=---->------------
+ 1 indented --
+ 2 different --+