Wrapping Up

We’ve looked at two different techniques in this chapter, one used more frequently than the other, but both useful in their way. First, we explored how to write to other processes, allowing us to leverage the power of existing utilities within our scripts. We then looked at how we could use this in combination with redirecting our own standard output stream, in this case to page the output from our script.

Then we looked at writing to files, which, while straightforward, is the single most common task we face when wanting to write data somewhere. We also looked at the Ruby standard library’s capacity to create temporary files that are cleaned up after our script finishes its execution.

Now that we’ve looked at the mechanisms of writing, ...

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.