en bash, si je veux exécuter une commande et afficher uniquement les lignes de sortie qui correspondent à un certain modèle, je peux le diriger vers grep, comme
fichier test de fichier
hello
there
my
friends
commander
$ cat testfile | grep 'hello'
hello #this will be highlightd
cela mettra en évidence la correspondance de recherche et affichera toute la ligne sur laquelle elle se trouve. Je peux utiliser -Aet -Bpour afficher les lignes avant et après cette ligne. Ma question est la suivante: est-il possible d'exécuter la commande et d'afficher toutes les sorties normalement, mais de mettre en évidence les correspondances de recherche comme le ferait grep? donc ma sortie serait
hello #highlighted
there
my
friends