Bug #13736
Updated by nobu (Nobuyoshi Nakada) about 7 years ago
Suppose you have blocks of text separated by 2 or more \n. A typical text file with records defined by a black line. Given: ``` $ `$ cat lines f1, r1 f2, r1 then 2 \n: f1, r2 then 3 \n: f1,r3 f2,r3 then 4 \n: f1, r4 f2,r4 then 6 \n: f1,r5 ``` f1,r5` The script `$ ruby -00 -F"\n" -lane 'END{p $.}' lines` SHOULD have the same number of records as `$ ruby -F"\n" -lane 'BEGIN{$/=""}; END{p $.}' lines`. It does not not. The script `$ ruby -00 -F"\n" -lane 'END{p $.}' lines` SHOULD have the same number of record as `$ perl -00 -F"\n" -lane 'END{print $.}' lines` Again, it does not. The script `$ ruby -00 -F"\n" -lane 'END{p $.}' lines` shows 8. The other scripts here show 5 -- the correct number. The behavior of the `-00` command switch is not the same as perl's `-00` command switch. It is also not the same as setting `$/=""` in either ruby or perl. The `\n\n` pattern between blocks should be a single record separator even if you have `\n\n\n\n\n` That is true in perl, awk, gawk, and ruby with `$/=""`. It is not true with `ruby -00`. This is a bug.