App-Greple
view release on metacpan or search on metacpan
### list up all Japanese Katakana words / çä»®åã®åèªãå
¨é¨æãåºã
greple -ho --nocolor --join '\p{utf8::InKatakana}[\n\p{utf8::InKatakana}]*'
### you like it? / æ°ã«å
¥ã£ãããããªé¢¨ã«ã©ãã
cat >> ~/.greplerc
define :kana: \p{utf8::InKatakana}
option --kanalist --color=never --only-matching --join --re ':kana:[:kana:\n]+'
### find `cyclic redundancy c*`
greple -pi -e 'cyclic redundancy c\w+' rfc*
greple -o --joinby=' ' -ie 'cyclic redundancy c\w+' rfc*
### find Kanji and not CJKUnifiedIdeographs / æ¼¢åã ãã© CJKUnifiedIdeographs ãããªãæåãæ¢ã
greple --inside='\p{Han}+' '[^\s\p{InCJKUnifiedIdeographs}]'
# This works, but quite slow. Not recommended.
# åããã©ãã§ã¼é
ããããããªãã¨ãã¡ãé§ç®ãã
### guess data encoding / æåã³ã¼ããèªåå¤å®ãã
greple --icode=guess
### specify data encoding / æåã³ã¼ããæå®ãã
greple --icode=euc-jp
greple --icode=shif-jis
### specify guessing code set / èªåå¤å®ããã³ã¼ããæå®ãã
greple --icode=utf8,euc-jp,shift-jis,7bit-jis
### add to guessing code set / èªåå¤å®ããã³ã¼ãã追å ãã
greple --icode=+euc-kr
---
## Filter / ãã£ã«ã¿ã¼
### expand tabs before seach / ã¿ããå±éãã¦ããæ¤ç´¢ãã
greple -n --if=expand
# give better looking for tab indented text
### find from EXIF data / EXIF æ
å ±ãæ¤ç´¢ãã
greple --if='env LC_ALL=en_US exif -x /dev/stdin' 'Image_Description|Manufacturer' *.jpg
---
## Print Function / ããªã³ã颿°
### Search iCal data / iCal ã®ãã¼ã¿ãæ¤ç´¢ãã
help --ical Search iCal data
option --ical \
--all \
--chdir ~/Library/Calendars/*.caldav/*.calendar/Events \
--glob *.ics \
--print print_ical_line
__CODE__
sub print_ical_line {
s/\r//g;
my $s = '';
my(@s, @e);
if (@s = /^DTSTART.*(\d{4})(\d\d)(\d\d)(?:T(\d\d)(\d\d))?/m) {
$s .= "$1/$2/$3";
$s .= " $4:$5" if defined $4;
}
if (@e = /^DTEND.*(\d{4})(\d\d)(\d\d)(?:T(\d\d)(\d\d))?/m) {
if ($s[0]eq$e[0] and $s[1]eq$e[1] and $s[2]+1>=$e[2]) {
$s .= "-$4:$5" if defined $4;
} else {
$s .= "-";
$s .= "$1/" if $s[0] ne $e[0];
$s .= "$2/$3";
}
}
$s .= " ";
/^SUMMARY:(.*)/m and $s .= $1;
/^LOCATION:(.*)/m and $s .= " \@[$1]";
$s .= "\n";
$s;
}
( run in 1.749 second using v1.01-cache-2.11-cpan-39bf76dae61 )