るびまゴルフ(3)
http://jarp.does.notwork.org/diary/200803c.html#200803311
なるほど…。
$ cat 3.rb
#!ruby -alp $><<[$.,$F.size,~/$/,p]*" "
$ cat 3.in TEST foo bar baz The quick brown fox jumps over the lazy dog. $ cat 3.out 1 1 4 TEST 2 3 11 foo bar baz 3 9 44 The quick brown fox jumps over the lazy dog. $ ./3.rb < 3.in | diff -s - 3.out 3c3 < 3 9 43 The quick brown fox jumps over the lazy dog --- > 3 9 44 The quick brown fox jumps over the lazy dog. \ No newline at end of file
およ。入力の最後に改行が無いからか。-l が余計かな?
$ cat 3_.rb
#!ruby -pa $_=[$.,$F.size,~/$/,$_]*' '
$ ./3_.rb < 3.in | diff -s - 3.out Files - and 3.out are identical
通った。38B。