Print different values based on conditions

awk

  • A versatile programming language for working on files.
    More information: <https://github.com/onetrueawk/awk>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

awk '{if ($1 == "foo") print "Exact match foo"; else if ($1 ~ "bar") print "Partial match bar"; else print "Baz"}' {{filename}}

click the source code to copy install awk on any operating system with command-not-found.com