Skip to main content
Fixed the highlighting
Source Link
F1Linux
  • 2.8k
  • 2
  • 23
  • 34

In order to "trap" the searched term when grepping grep ping dpkg output, need to encase the search term as follows. "git" is used as the specimen search term:

dpkg -l |grep "^ii  git[[:space:]]"

The caratcarat (^) iiii followed by (2) spaces prepending the searched term ensures nothing BEFORE it other than that combination of characters can match.

The [[:space:]] abutting the searched term precludes partial matches from occurring by only matching spaces immediately AFTER it.

In order to "trap" the searched term when grepping dpkg output, need to encase the search term as follows. "git" is used as the specimen search term:

dpkg -l |grep "^ii  git[[:space:]]"

The carat (^) ii followed by (2) spaces prepending the searched term ensures nothing BEFORE it other than that combination of characters can match.

The [[:space:]] abutting the searched term precludes partial matches from occurring by only matching spaces immediately AFTER it.

In order to "trap" the searched term when grep ping dpkg output, need to encase the search term as follows. "git" is used as the specimen search term:

dpkg -l |grep "^ii  git[[:space:]]"

The carat (^) ii followed by (2) spaces prepending the searched term ensures nothing BEFORE it other than that combination of characters can match.

The [[:space:]] abutting the searched term precludes partial matches from occurring by only matching spaces immediately AFTER it.

Source Link
F1Linux
  • 2.8k
  • 2
  • 23
  • 34

In order to "trap" the searched term when grepping dpkg output, need to encase the search term as follows. "git" is used as the specimen search term:

dpkg -l |grep "^ii  git[[:space:]]"

The carat (^) ii followed by (2) spaces prepending the searched term ensures nothing BEFORE it other than that combination of characters can match.

The [[:space:]] abutting the searched term precludes partial matches from occurring by only matching spaces immediately AFTER it.