ファイルの文字数を表示するCotEditorスクリプト
行数と文字数(改行含む)を表示する。やっつけ。
#!/usr/bin/ruby1.9 # %%%{CotEditorXInput=AllText}%%% # %%%{CotEditorXOutput=AppendToAllText}%%% while l = STDIN.gets lines += 1 len += l.length end print "#{lines} lines, #{len} chars."
行数と文字数(改行含む)を表示する。やっつけ。
#!/usr/bin/ruby1.9 # %%%{CotEditorXInput=AllText}%%% # %%%{CotEditorXOutput=AppendToAllText}%%% while l = STDIN.gets lines += 1 len += l.length end print "#{lines} lines, #{len} chars."