Ruby One-Liners Guide

$10
3 ratings

About

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.

Ruby One-Liners Guide 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.

This book heavily leans on examples to present features one by one. Exercises are also included to test your understanding.


Promo video


Prerequisites

You should be comfortable with programming basics and have prior experience working with Ruby. You should know concepts like blocks, be familiar with string/array/hash/enumerable methods, regular expressions etc.

You should be familiar with command line usage in a Unix-like environment. You should also be comfortable with concepts like file redirection and command pipelines. Knowing the basics of the grep, sed and awk commands will come in handy as well.

You are also expected to get comfortable with reading manuals, searching online, visiting external links provided for further reading, tinkering with illustrated examples, asking for help when you are stuck and so on. In other words, be proactive and curious instead of just consuming the content passively.


Testimonials

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

— feedback on twitter


Sample chapters

For a preview of the book, see sample chapters on GitHub.


GitHub repo

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


Chapters

  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


Feedback and Errata

I would highly appreciate it if you'd let me know how you felt about this ebook. 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:

I want this!
26 sales

You'll get PDF and EPUB versions of the book.

Pages
87
Last Updated
2024-02-20
Copy product URL

Ratings

5.0
(3 ratings)
5 stars
100%
4 stars
0%
3 stars
0%
2 stars
0%
1 star
0%
$10

Ruby One-Liners Guide

3 ratings
I want this!