App-Bin4TSV
view release on metacpan or search on metacpan
scripts/colorplus view on Meta::CPAN
return $_[0] if $_[0] !~ m/^\d/ ;
my @parts ; push @parts , substr $_[0] , -$o{n} , $o{n} , '' while $_[0] ne '' ; # ä¸ä½ãã $o{n}æ¡ãã¤åå²ããã
my $outstr = '' ; $outstr .= $nCol[ $_ % 3 ] . $parts[$_] for reverse 0 .. $#parts ;
return $outstr . $RESET ;
}
}
## ãã«ãã¨ãã¼ã¸ã§ã³æ
å ±
BEGIN {
our $VERSION = 0.31 ;
$Getopt::Std::STANDARD_HELP_VERSION = 1 ;
grep { m/--help/} @ARGV and *VERSION_MESSAGE = sub {} ;
# æå㯠0.21 ãç®å®ã¨ããã
# 1.00 以ä¸ã¨ããå¿
è¦æ¡ä»¶ã¯è±èªçã®ãã«ãããã¡ãã¨åºããã¨ã
# 2.00 以ä¸ã¨ããå¿
è¦æ¡ä»¶ã¯ãã¹ãã³ã¼ããå«ããã¨ã
## colorplus.pl
## 2015-06-18 ä¸éå¯¿ä¹ ; 2018-03-28
}
sub HELP_MESSAGE {
use FindBin qw[ $Script $Bin ] ;
sub EnvJ ( ) { $ENV{LANG} =~ m/^ja_JP/ ? 1 : 0 } ; # # ja_JP.UTF-8
sub en( ) { grep ( /^en(g(i(sh?)?)?)?/i , @ARGV ) ? 1 : 0 } # English ã¨ããæååãå
é ãã2æå以ä¸ãå«ãã
sub ja( ) { grep ( /^jp$|^ja(p(a(n?)?)?)?/i , @ARGV ) ? 1 : 0 } # jp ã¾ã㯠japan ã¨ããæååãå
é ãã2æå以ä¸ãå«ãã
sub opt( ) { grep (/^opt(i(o(ns?)?)?)?$/i, @ARGV ) ? 1 : 0 } # options ã¨ããæååãå
é ãã3æå以ä¸å«ããã
sub noPOD ( ) { grep (/^no-?p(od?)?\b/i, @ARGV) ? 1 : 0 } # POD ã使ããªãã¨è¨ãæå®ãããã¦ãããã©ãã
my $jd = "JapaneseManual" ;
my $flagE = ! ja && ( en || ! EnvJ ) ; # è±èªã«ãããã©ããã®ãã©ã°
exec "perldoc $0" if $flagE && ! opt ; #&& ! noPOD ;
$ARGV[1] //= '' ;
open my $FH , '<' , $0 ;
while(<$FH>){
s/\Q'=script='\E/$Script/gi ;
s/\Q'=bin='\E/$Bin/gi ;
if ( s/^=head1\b\s*// .. s/^=cut\b\s*// ) {
if ( s/^=begin\s+$jd\b\s*// .. s/^=end\s+$jd\b\s*// xor $flagE ) {
print $_ if ! opt || m/^\s+\-/ ;
}
}
}
close $FH ;
exit 0 ;
}
=encoding utf8
=head1 NAME
colorplus
=head1 VERSION
0.31 (2018-07-10)
=head1 SYNOPSIS
colorplus [-0] [-n N|-3|-4] [-c colorname] [-e N[,N[,N..]]] [-l N] [-s REGEX] [-t N] [-/ char]
colorplus [--help [opt|en]] [--version]
=head1 DESCRIPTION
Put colors (ASCII color escape sequnces) parts on text data such as numerical parts,
columns cyclically, text matching specific regular expressions. Useful to look around
CSV/TSV files with a pager LESS (less -R).
=head1 OPTIONS
=over 4
=item B<-0>
Remove colors (remove all the ASCII color escape sequences).
=item B<-n> N
Put colors on numerical characters. Every neighboring N digits from the bottom of a numerical
character sequence has a same color. Cyan, green, yellow are used to colorize.
=item B<-3>
Same as the specification B<-n 3>.
=item B<-4>
Same as the specification B<-n 4>.
=item B<-c> colorname
Speficy the colorname. It can be "blue", "red", "yellow", and also "on_while", "underline" and so on.
See the ASCII color escape sequences.
=item B<-e> N,N,...
Any operation by "colorplus" is exemplified on the lines specified by the number(s) beginning from 1.
-0 is also cancelled on the specified lines, thus in this case, the input color on the specified line
will survive.
=item B<-l> N
One line from every N lines are colored. The default color : "on_blue".
=item B<-s> REGEX
The matched charcter string by the regular expression specified will be colored.
=item B<-t> N
Every neighboring N column(s) has a same color such as "untouched" and "on_blue".
"On_blue" can be changed by the colorname specified by "-b".
=item B<-/> string
The column delimiter. Default value is a tab character (\x{09}). IF '' (empty string) is
specified, each character in the input text is regarded as a column.
=item B<--help>
Show this help.
=item B<--help ja>
Show Japanese help manual.
=item B<--version>
Show the version of this program.
=back
=head1 EXAMPLE
B<colorplus -n 3> # Every number is colorized 3 digits by 3 digits.
B<colorplus -t 5> # Every 5 columns is cyclically colorized.
B<colorplus -s> "hello" B<-b> bright_yellow # Specific character string is colorized.
=head1 AUTHOR
Toshiyuki Shimono <bin4tsv@gmail.com>
=head1 LICENSE AND COPYRIGHT
Copyright 2018 "Toshiyuki Shimono".
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
( run in 0.768 second using v1.01-cache-2.11-cpan-39bf76dae61 )