Using sed to Create Book Indexes: Lessons from a Publishing Workflow

Using sed to make indexes for books (long)

I needed to automate book index creation after typesetting, moving from manual entry to a sorted file. While an awk script worked, I discovered a more concise sed solution. However, a single formatting error in the input could break the entire process. I explain how the script fails and offer a robust fix to validate data before processing.

If one line anywhere in the file was in error, the script would fail to change every other line after that.

More from this day

2026-07-26