I am pleased to announce a new version of my Perl 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, Perl has a feature rich regular expression engine, plenty of builtin modules and a thriving ecosystem. Another advantage is that Perl 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 Perl One-Liners Guide for FREE till 07-October-2023. You can still pay if you wish ;)

All Books Bundle is just $12 (normal price $32), includes all my 13 programming ebooks.

What's new?πŸ”—

  • Command version updated to Perl 5.38.0
    • option -g slurps entire file contents
  • Many more exercises added
  • 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 Perl One-Liners Guide
  • New cover image


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


This is fantastic! πŸ‘ I use Perl one-liners for record and text processing a lot and this will be definitely something I will keep coming back to - I’ve already learned a trick from β€œContext Matching” (9) πŸ™‚

β€” feedback on Linux@lemmy.ml

Table of ContentsπŸ”—

  1. Preface
  2. One-liner introduction
  3. Line processing
  4. In-place file editing
  5. Field separators
  6. Record separators
  7. Using modules
  8. Multiple file input
  9. Processing multiple records
  10. Two file processing
  11. Dealing with duplicates
  12. Perl rename command

Web versionπŸ”—

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

GitHub repoπŸ”—

Visit https://github.com/learnbyexample/learn_perl_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.


Subscribe to learnbyexample weekly β€” free newsletter covering programming resources, updates on what I am creating, tips, tools, free 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 :)