Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

How to lose ANSI color from String

  • 03-03-2016 09:10AM
    #1
    Registered Users, Registered Users 2 Posts: 262 ✭✭


    Can be via Java or shell - Im getting outputs like

    [92mourStuff_2a947-user-zk4PaQ [][0m


Comments

  • Registered Users, Registered Users 2 Posts: 1,275 ✭✭✭bpmurray


    What's the text? If you're referring to colour codes, you're presumably missing some escape characters. Is this supposed to read "ourStuff_2a947-user-zk4PaQ"?


  • Registered Users, Registered Users 2 Posts: 1,393 ✭✭✭Inspector Gadget


    StackExchange for the win.

    Basically, they're escape codes, which means they start with the <ESC> character (ASCII 27, Octal 33, Hex 1B) and then have a regex-matchable format.

    The suggestions at the link above should help you (either just drop in the Perl script, or use the regexes offered in Java and/or shell with sed)


Advertisement