DEV Community

Discussion on: How Unix programmers at restaurants search menus for their favorite plate

Collapse
 
tomislacker profile image
Ben Tomasik

What sort of monster does cat | grep !?

Collapse
 
jgomo3 profile image
Jesús Gómez

Some people, including me:

reddit.com/r/programming/comments/...

Collapse
 
blackknight36 profile image
Michael • Edited

You can almost accomplish this entire task using awk. For example:

awk -F '$' '/shrimp/ {printf "%s- %.2f\n", $1, $NF}' < menu.txt

Collapse
 
rubberduck profile image
Christopher McClellan

awk is Turing Complete.
s/almost//

Collapse
 
acidnik profile image
acidnik

With real life menus with millions of lines, you usually start with head | grep, and then, when you one-liner of 15 lines is complete, you replace head with cat and cross your fingers

Collapse
 
jeshan profile image
Jeshan Giovanni BABOOA

real life menus with millions each? ;)

Thread Thread
 
acidnik profile image
acidnik

That was my attempt to make a joke

Collapse
 
pwntweets profile image
Pulkit Singhania

Grep won't be able to find anything because you are searching for ! Which is not in the menu