
Wenn packagehello
keine Übereinstimmung vorliegt, wird die Ausgabe trotzdem angezeigt.
Ziel:zu sehen no output
in Situation 2
Situation 1:
user@hostname ~]$ sudo yum list 'package*'
packagehello
packagehello
package2world
packagehello
package2world
Situation 2:
user@hostname ~]$ sudo yum list 'package*' | grep -E 'package1.*|package2.*'
package2world
package2world
Wie zeigt man in der Ausgabe an, dass only if
beide Wörter mit übereinstimmen grep
?
Antwort1
Versuche dies:
sudo yum list 'package*' |
grep -E 'package1.*package2|package2.*package1'
oder mit mehreren grep
:
sudo yum list 'package*' |
grep 'package1' |
grep 'package2'