TransWikia.com

How to make grep to blink the matched pattern?

Unix & Linux Asked by αғsнιη on February 11, 2021

What color-schemas should I set to grep’s GREP_COLORS ENV-Variable to enable the blinking mode on matched pattern?

One Answer

GREP_COLORS='mt=X;Y;Z' grep --color 'pattern' infile

  • X can set to one of these (represent the Display Attributes):
    0 Reset all attributes
    1 Bright
    2 Dim
    4 Underscore
    5 Blink
    7 Reverse
    8 Hidden

  • Y can set to one of these (represent the Foreground Colors):
    30 Black
    31 Red
    32 Green
    33 Yellow
    34 Blue
    35 Magenta
    36 Cyan
    37 White

  • Z can set to one of these (represent the Background Colors):
    40 Black
    41 Red
    42 Green
    43 Yellow
    44 Blue
    45 Magenta
    46 Cyan
    47 White

So to blinking the pattern set mt (Matched-Text) to: mt=5;Y;Z (Choose Y &Z colors one from the above list); "note that your Terminal should support the ANSI Colors":

GREP_COLORS='mt=5;30;43' grep --color 'pattern' infile

see GREP_COLORS options for more.

Answered by αғsнιη on February 11, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP