Hacker News new | ask | show | jobs
by elcaro 1668 days ago
The first operation where I split to lines, then join, then split again... was annoying me. So now I've got this

  say qx< cal -hy >.lines.skip.batch(9)
    .map({ |([Z] .join.comb(22).batch(3)) })
    .map({ |(.[2] ~ .[0].trim, |.[3 .. *]) })
    .grep(*.trim.chars).join("\n")
    .subst(/\s+ ^^ \s\s+ 1ยป/, '  1', :g)