Brian Kernighan on the Origins of ‘grep'

“grep was written to find text in a hand written document from the 1800s”

“the original grep was written in PDP-11 assembly language”

“Let me add one thing,” Kernighan remembers with a laugh. Twenty-five years ago, in the spring of 1993, he’d been teaching as a visiting professor and needed an assignment for his programming class. So he provided his students the source code for ed — “It was at that time probably 1800 lines of C” — and told them to do what Ken Thompson did.

“Your job is to take these 1800 lines of C and convert them into grep, as a C program. And you’ve got a week to do it.”

(See also previous topics: Unix Tell All Book From Kernighan Hits The Shelves and Brian Kernighan interviews Ken Thompson at VCF East)


Computerphile did a whole series of videos with Brian. GREP was one of them.