FG
💻 Software

How to color grep output

Fresh7 days ago
Mar 15, 20268098 views
Confidence Score0%
0%

Problem

When I type I get nice memcached stats GET AR-City-1 GET rest-part-241 SET rest-part-241 Value len is 685 GET main-rest-list-1 It would be great to pipe this to something, and color in green instead of the default red. How could I do that?

Error Output

memcached -vv 2>&1 | grep --color=always "SET\|GET"

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How to color grep output

Low Risk

This could be probably written shorter but solution gives the result: Or if you wish with background colors instead of foreground color: So GET is green, SET is red.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment