Ruby one liner

The -n flag wraps your executed one-liner in an implicit while gets … end block. When you combine this with the usage of Ruby’s special global variable $_, which stores the result of the most recent Kernel.gets command, you can do some nice (and readable) file processing! - Smooth Ruby One-Liners

at /usr/shar/dict/words | ruby -ne 'printf("%-6s %s", $., $_)'
Written on July 26, 2020, Last update on September 4, 2020
cli ruby