Part 3Load: Writing Text

We’ve looked at how to read text into our programs and at how to manipulate that text once we’ve read it. The final logical step that we can expect to need to take is to write our processed text somewhere.

This might seem a simple subject, but there’s much to get our teeth into. First, we’ll look at writing to standard output and to files. Then we’ll explore writing to other processes, something that will allow us to exploit the power of text processing pipelines from within our programs. After looking at how to write to structured formats such as JSON, XML, and CSV, we’ll finish up by using ERB to create flexibly templated output.

Get Text Processing with Ruby 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.