Chapter 8. Ruby One-Liners
You might be asking yourself, “Why one-liners?” To the bearded UNIX guru, it is obvious that each of these examples can be accomplished (and perhaps improved) with simple bash, grep, sed
, or awk
commands. However, the motivation for this section is twofold: Our readers from the Windows world will find that those programs aren’t available for their platform unless they install something like Cygwin
. In addition, most of us mere mortals cannot remember all the semantics for several programming languages 100% of the time. For the programmer and system administrator who swim in Ruby most of the time, it is nice to be able to use knowledge you already have to solve everyday issues. Besides, one-liners are fun!
Get Ruby Phrasebook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.