Hello!

I am pleased to announce a new version of my Ruby One-Liners Guide ebook. Examples, exercises, solutions, descriptions and external links were added/updated/corrected.

When it comes to command line text processing, there are several well known tools like grep for filtering, sed for substitution and awk for field processing. Compared to such tools, Ruby has a feature rich regular expression engine, plenty of builtin modules and a thriving ecosystem. Another advantage is that Ruby is more portable.

This ebook will show examples for filtering and substitution features, field processing, using standard and third-party modules, multiple file processing, how to construct solutions that depend on multiple records, how to compare records and fields between two or more files, how to identify duplicates while maintaining input order and so on.


Release offers🔗

To celebrate the new release, you can download PDF/EPUB versions of Ruby One-Liners Guide for FREE till 29-February-2024. You can still pay if you wish ;)

Ruby Text Processing bundle is free as well:

So is the Magical one-liners bundle:


What's new?🔗

  • Command version updated to Ruby 3.3.0
  • Added more exercises
  • Long sections split into smaller ones
  • In general, many of the examples, exercises, solutions, descriptions and external links were updated/corrected
  • Updated Acknowledgements section
  • Code snippets related to info/warning sections will now appear as a single block
  • Book title changed to Ruby One-Liners Guide
  • New cover image

Videos🔗

On this blog, I post tips covering Python, command line tools and Vim. Here are video demos for these tips:


Testimonials🔗

This Ruby one-liners cookbook is incredible. Pretty mind boggling all the stuff you can do.

feedback on twitter


Table of Contents🔗

  1. Preface
  2. One-liner introduction
  3. Line processing
  4. Field separators
  5. Record separators
  6. Multiple file input
  7. Processing multiple records
  8. Two file processing
  9. Dealing with duplicates
  10. Processing structured data

Web version🔗

You can also read the book online here: https://learnbyexample.github.io/learn_ruby_oneliners/.


GitHub repo🔗

Visit https://github.com/learnbyexample/learn_ruby_oneliners for markdown source, example files, exercise solutions, sample chapters and other details related to the book.

info See also my blog post on how to customize pandoc for generating beautiful PDF/EPUB versions from GitHub style markdown.


Newsletter🔗

Subscribe to learnbyexample weekly — free newsletter covering programming resources, updates on what I am creating, tools, ebooks and more, delivered every Friday.


Feedback and Errata🔗

I would highly appreciate it if you'd let me know how you felt about this book. It could be anything from a simple thank you, Gumroad rating, pointing out a typo, mistakes in code snippets, which aspects of the book worked for you (or didn't!) and so on. Reader feedback is essential and especially so for self-published authors.

You can reach me via:

Happy learning :)