Skip to content

Instantly share code, notes, and snippets.

Created December 12, 2012 09:07
Show Gist options
  • Save anonymous/4266274 to your computer and use it in GitHub Desktop.
Save anonymous/4266274 to your computer and use it in GitHub Desktop.
Use Perl to strip ANSI codes from STDOUT
#! /usr/bin/perl
# @link: http://unix.stackexchange.com/questions/4527/program-that-passes-stdin-to-stdout-with-color-codes-stripped
use strict;
use warnings;
while (<>) {
s/\e\[?.*?[\@-~]//g; # Strip ANSI escape codes
print;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment