![https://atnd.org/events/63979](https://cdn-ak-scissors.b.st-hatena.com/image/square/ef6ae8cef5ec8fa5432177eabd58642127e7d973/height=288;version=1;width=512/https%3A%2F%2Fatnd.org%2Fassets%2F20140404_twitter_icon-822f2e35e1300a8a4322582d2345479e.png)
10. 行数のカウント p $<.count 確認 wc hightemp.txt $< の仕様はまさにこういう処理を書くために考えられている。 が、今回に関しては普通ならわざわざ書かずにwcを使う。 11. タブをスペースに置換 $<.each_line do |line| puts line.gsub("\t", ' ') end 確認 sed "s/^I/ /g" hightemp.txt 12. 1列目をcol1.txtに,2列目をcol2.txtに保存 File.open("col1.txt", "w") {|f1| File.open("col2.txt", "w") {|f2| $<.each_line do |line| cols = line.split("\t") f1.puts cols[0] f2.puts cols[1] end } } 確認 cut -f1 hi
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く