りすこがこんなの書いてて、聞いてみたら名詞だけ抜き出してcountとかやりたいとか。 そういう時はawk使うと便利ですよ(perlでもいいですが)
$ cat filename | awk '$4 ~ /^名詞/{print $1}' | sort | uniq -c | sort -n
4個目のカラムが「品詞」で始まる性質を使ってます。
use strict; | |
use warnings; | |
use IPC::Open2 qw(open2); | |
## warning = Name "main::OUT1" used only once: possible typo | |
open2(\*OUT1, undef, 'iostat', '1', '3'); | |
open2(\*OUT2, "<&OUT1", 'cat', '-nu'); | |
print while(<OUT2>); | |
## error = open2: close(main::GLOB(0x827988)) failed: Bad file descriptor |
use strict; | |
use warnings; | |
use IO::Handle; | |
use Parallel::ForkManager; | |
my $pm = Parallel::ForkManager->new(2); | |
my ($pread, $pwrite); | |
pipe $pread, $pwrite; |
use strict; | |
use warnings; | |
use Plack::Builder; | |
use Plack::Session; | |
use Plack::Session::State::Cookie; | |
use Plack::Session::Store::Cache; | |
use Authen::Simple::DBI; | |
use Data::Section::Simple; | |
use Text::Xslate; | |
use Cache::Memcached::Fast; |
--- /usr/local/Library/Homebrew/cmd/install.rb.bak 2011-04-01 04:18:15.000000000 +0900 | |
+++ /usr/local/Library/Homebrew/cmd/install.rb 2011-04-01 05:05:30.000000000 +0900 | |
@@ -23,7 +23,7 @@ | |
def check_writable_install_location | |
raise "Cannot write to #{HOMEBREW_CELLAR}" if HOMEBREW_CELLAR.exist? and not HOMEBREW_CELLAR.writable? | |
- raise "Cannot write to #{HOMEBREW_PREFIX}" unless HOMEBREW_PREFIX.writable? | |
+ raise "Cannot write to #{HOMEBREW_PREFIX}" unless HOMEBREW_PREFIX.writable_real? | |
end | |
[~/.cpanm/latest-build/AnyEvent-Impl-NSRunLoop-0.04]$ perl -Mlib=blib/lib t/03_child.t | |
1..50 | |
ok 1 | |
ok 2 | |
ok 3 # 26944 == 26944 | |
ok 4 # 3 == 768 >> 8 (768) | |
ok 5 # 26945 == 26945 | |
ok 6 # 7 == 1792 >> 8 (1792) | |
ok 7 | |
ok 8 |
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use FindBin; | |
use lib "$FindBin::RealBin/lib"; | |
use lib "$FindBin::RealBin/extlib/lib/perl5"; | |
use Cache::LRU; | |
use Config::Simple; | |
use Cybozu::Garoon::Notify; |
use strict; | |
use warnings; | |
use File::Copy; | |
open my $conf, '<', '/etc/my.cnf' or die; | |
open my $conf_new, '>', '/tmp/my.cnf' or die; | |
while (<$conf>) { | |
chomp; | |
my $line = |
use strict; | |
use warnings; | |
use Test::More qw(no_plan); | |
use FindBin; | |
my $extlib = "/home/riywo/extlib"; | |
isnt(`which gcc`, '', 'check gcc') or &{ | |
diag(`sudo yum install gcc -y`); | |
}; |
use strict; | |
use warnings; | |
use Test::More; | |
open my $fh, '>', \(my $output_buffer = ''); | |
Test::More->builder->output($fh); | |
Test::More->builder->failure_output($fh); | |
Test::More->builder->todo_output($fh); | |
note "hoge"; |
りすこがこんなの書いてて、聞いてみたら名詞だけ抜き出してcountとかやりたいとか。 そういう時はawk使うと便利ですよ(perlでもいいですが)
$ cat filename | awk '$4 ~ /^名詞/{print $1}' | sort | uniq -c | sort -n
4個目のカラムが「品詞」で始まる性質を使ってます。