nixCraft,
@nixCraft@mastodon.social avatar

Here is how use awk with a regular expression to match lines containing the word "nginx" and the first fireld must be "ii". In other words, it will show all installed nginx package names on your Debian or Ubuntu Linux:

awk '$1 == "ii" && /nginx/ { print $2}' <<<$(dpkg --list)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • ngwrru68w68
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • megavids
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • provamag3
  • JUstTest
  • All magazines