DEV Community

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

Collapse
 
catchenal profile image
Cat Chenal • Edited

Given this menu:

ps1$cat menu.txt

the menu

steak burrito $11.95
pasta and shrimp $9.75
caesar salad $6.50
shrimp salad $9.99
alfredo shrimp $10

My Nix programmer does this:

awk -F$ '/shrimp/{if ($NF < 10){ print $1}}' menu.txt

pasta and shrimp
shrimp salad

awk rules!

Collapse
 
labibllaca profile image
labibllaca

if you are looking for meals under 10 bucks, as shown in ($NF < 10), why isn't caesar salad($6.50) in the output ?