Created
April 28, 2014 22:03
-
-
Save shlomif/11385356 to your computer and use it in GitHub Desktop.
Equivalent Perl+Shell and Ruby One-Liners (For learning Ruby)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C=50 perl -plE 's/^[^\[]+//;$_=substr($_,0, $ENV{C});' < fc-solve-pseudo-dfs.log.txt | uniq -c | perl -plE 's/\d\K /\t\t/' | |
C=50 ruby -lne 'BEGIN{$C=0}; sub(/^[^\[]+/,""); $_= $_[0,ENV["C"].to_i]; $P ||= ""; f = lambda { printf("%10d\t\t%s\n", $C, $P) if$C>0; $P=$_;$C=1; }; if ($P != $_) then f.call() ;else $C += 1 end ; END{ f.call()}' < fc-solve-pseudo-dfs.log.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment