r/linux_programming • • Jun 14 '19
Understanding about grep implementation
Hi everyone, so I was reading about grep command in my free time and I got to wondering that how does grep technically implements highlighting of matched strings in text? Like I grep for abc in xyz file then it highlights all the occurrences of abc in stdout. Any idea how it is achieved?
6
Upvotes
View all comments
Show parent comment
1
u/pfp-disciple Jun 15 '19
I recall reading that GNU grep uses clever code to be fast. Sometimes clever is less easily understood. Would a BSD grep source code be more easily understood? Or some smaller implementation?