Skip to content

Instantly share code, notes, and snippets.

@lisa
Created September 26, 2021 16:48
Show Gist options
  • Save lisa/55599f844c82ca8512c893927604ef07 to your computer and use it in GitHub Desktop.
Save lisa/55599f844c82ca8512c893927604ef07 to your computer and use it in GitHub Desktop.
Strip ANSI with Perl
#!/bin/bash
# An implementation of https://superuser.com/questions/380772/removing-ansi-color-codes-from-text-stream/380778
# usage: ./stripansi.sh "src" "dest"
cat "${1}" | perl -pe 's/\x1b\[[0-9;]*[mG]//g' > "${2}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment