Wrapping Up
We looked at how, for a certain type of text processing utility—a filter, in essence—ARGF makes handling both standard input and files easy. We looked at how we can process ARGF as a stream, reading lines sequentially without caring where they come from. Next we modified files in place, giving us the ability to write find-and-replace types of utilities that work across many files. Finally, we saw how we could manipulate ARGV either to skip certain arguments and not process them as files, or to add to the list of arguments and process files that weren’t passed on the command line.
ARGF neatly combines the previous chapters in this section. We can now get text into our program from standard input and from files, and we know how to write ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access