Hacker News new | past | comments | ask | show | jobs | submit login

    ps auxww|sed -n '/ doesnotexist /d;/banana/p'
When/if grep is not available



What systems don’t have grep? Off the top of my head, anything vaguely POSIX compliant would have it, and anything descended from 4th Edition Unix would also have it, which seems like it would cover everything.


"What system don't have grep?"

Emedded systems is one answer.

Toolchains for compiling systems from source is another answer, e.g., NetBSD's toolchain has sed, but not grep.

A third answer is install media. For example, NetBSD install kernels have ramdisks with sed but not grep.

A fourth answer is personal, customised systems. I create small systems that run from RAM. I run these on small computers with limited resources. When one of these computers first boots up, it may not have a "full" set of userland programs. It may not have grep. I am not inclined to use the limited space available to include grep at such an early stage if I can get by with sed.

Hope this answers your question.


The most common cases today are probably Docker containers, which are often based on the most minimal image possible. Alpine doesn't have grep iirc.


> Hope this answers your question.

It does, thanks for the detailed response.


Maybe someone deleted grep by accident? Or maybe you accidentally traveled in time to the 70's and need to use a nearby PDP-11 to calculate a way home? Lots of possibilities.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: