Skip to main content
Improved formatting. Minor fixes.
Source Link
Pablo A
  • 3.2k
  • 1
  • 26
  • 46
# The "sed -r" trick does not work on every Linux, I still dunno why:
DECOLORIZE='eval sed "s,${END}\[[0-9;]*[m|K],,g"'
# The "sed -r" trick does not work on every Linux, I still dunno why:
DECOLORIZE='eval sed "s,${END}\[[0-9;]*[m|K],,g"'

=> howto use:

How to use

<commands that type colored output> | ${DECOLORIZE}

testedTested on:

  • AIX 5.x / 6.1 / 7.1
  • Linux Mandrake / Mandriva / SLES / Fedora
  • SunOS
# The "sed -r" trick does not work on every Linux, I still dunno why:
DECOLORIZE='eval sed "s,${END}\[[0-9;]*[m|K],,g"'

=> howto use:

<commands that type colored output> | ${DECOLORIZE}

tested on:

  • AIX 5.x / 6.1 / 7.1
  • Linux Mandrake / Mandriva / SLES / Fedora
  • SunOS
# The "sed -r" trick does not work on every Linux, I still dunno why:
DECOLORIZE='eval sed "s,${END}\[[0-9;]*[m|K],,g"'

How to use

<commands that type colored output> | ${DECOLORIZE}

Tested on:

  • AIX 5.x / 6.1 / 7.1
  • Linux Mandrake / Mandriva / SLES / Fedora
  • SunOS
deleted 3 characters in body
Source Link
scavenger
  • 178
  • 1
  • 5
# The "sed -r" trick does not work on every Linux, I still dunno why:
DECOLORIZE='eval sed "s,${END}\[[0-9;]*[a-zA-Z]9;]*[m|K],,g"'

=> howto use:

<commands that type colored output> | ${DECOLORIZE}

tested on:

  • AIX 5.x / 6.1 / 7.1
  • Linux Mandrake / Mandriva / SLES / Fedora
  • SunOS
# The "sed -r" trick does not work on every Linux, I still dunno why:
DECOLORIZE='eval sed "s,${END}\[[0-9;]*[a-zA-Z],,g"'

=> howto use:

<commands that type colored output> | ${DECOLORIZE}

tested on:

  • AIX 5.x / 6.1 / 7.1
  • Linux Mandrake / Mandriva / SLES / Fedora
  • SunOS
# The "sed -r" trick does not work on every Linux, I still dunno why:
DECOLORIZE='eval sed "s,${END}\[[0-9;]*[m|K],,g"'

=> howto use:

<commands that type colored output> | ${DECOLORIZE}

tested on:

  • AIX 5.x / 6.1 / 7.1
  • Linux Mandrake / Mandriva / SLES / Fedora
  • SunOS
deleted 96 characters in body
Source Link
scavenger
  • 178
  • 1
  • 5
if# [The "$(uname"sed -s)"r" ==trick "SunOS"does ];not then
work on END=$(printfevery '\033[0m')
Linux, I still dunno why:
DECOLORIZE='eval sed "s,${END}\[[0-9;]*[a-zA-Z],,g"'
else
  DECOLORIZE='eval sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,3})*?)?[m|K]//g"'
fi

=> howto use:

<commands that type colored output> | ${DECOLORIZE}

tested on:

  • AIX 5.x / 6.1 / 7.1
  • Linux Mandrake / Mandriva / SLES / Fedora
  • SunOS
if [ "$(uname -s)" == "SunOS" ]; then
  END=$(printf '\033[0m')
  DECOLORIZE='eval sed "s,${END}\[[0-9;]*[a-zA-Z],,g"'
else
  DECOLORIZE='eval sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,3})*?)?[m|K]//g"'
fi

=> howto use:

<commands that type colored output> | ${DECOLORIZE}

tested on:

  • AIX 5.x / 6.1 / 7.1
  • Linux Mandrake / Mandriva / SLES / Fedora
  • SunOS
# The "sed -r" trick does not work on every Linux, I still dunno why:
DECOLORIZE='eval sed "s,${END}\[[0-9;]*[a-zA-Z],,g"'

=> howto use:

<commands that type colored output> | ${DECOLORIZE}

tested on:

  • AIX 5.x / 6.1 / 7.1
  • Linux Mandrake / Mandriva / SLES / Fedora
  • SunOS
just realized SunOS is capricious
Source Link
scavenger
  • 178
  • 1
  • 5
Loading
Source Link
scavenger
  • 178
  • 1
  • 5
Loading