タグ

unixとcliに関するopparaのブックマーク (2)

  • overlasting.net

    overlasting.net 2019 Copyright. All Rights Reserved. The Sponsored Listings displayed above are served automatically by a third party. Neither the service provider nor the domain owner maintain any relationship with the advertisers. In case of trademark issues please contact the domain owner directly (contact information can be found in whois). Privacy Policy

  • テキストファイルを処理するときのUnixコマンドまとめ - nokunoの日記

    個人的にテキストファイルを処理することが多いのですが,簡単な処理ならUnixのコマンドをパイプとリダイレクトで組み合わせてできることが多くあります.今回はそんななかでもちょっとマニアックなTIPSをまとめてみました. sortコマンドでタブ区切りのファイルを指定する最近知って驚愕したのがこれ.sortコマンドでタブ区切りのファイルを指定したいときは,Ctrl+v Tabでタブ文字を入力していたのですが,$ sort -t $'\t' -k 2,2 のようにしてタブ区切りで2番目のキーでソートすることができます. 1000行おきにデータをサンプリングする1000行おきにファイルからデータをサンプリングしたいときとかは,perlでワンライナーを書くのが速いようです.$ perl -ne '$i++; print unless ($i % 1000)' 某所のコードゴルフによるとこれだけ短くでき

  • 1