Skip to content

Instantly share code, notes, and snippets.

@ktnyt
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save ktnyt/b8b026865a2c206509cb to your computer and use it in GitHub Desktop.

Select an option

Save ktnyt/b8b026865a2c206509cb to your computer and use it in GitHub Desktop.
perl -lane '$.-1?$h{$_}=$F[7]:print"(answer1)\n$_"}{print join"\n",sort{$h{$b}<=>$h{$a}}keys%h' datas
perl -F'\t' -lane '$.-1?$F[4]?push@{$h{$F[0]}},[$F[4],$F[2],$F[5]]:"":print"(answer2)"}{map{print"[$_]"and map{print join":",@$_ if@$_}(sort{$b->[0]<=>$a->[0]}sort{$a->[1]<=>$b->[1]}@{$h{$_}})[0..4]}sort{$a cmp$b}keys%h' datas
perl -lane '$.-1?sub{$h{$1}++while/https?:\/\/(.+?)\//g}->():print"(answer3)"}{print join"\n",(map{join":",@$_}sort{$b->[0]<=>$a->[0]}map{[$h{$_},$_]}sort{$a cmp$b}keys%h)[0..4]' datas;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment