I was trying to pipe an output url into the open command but found several instances where despite changing the color settings of grep or piping further output through other utils like awk or cut I was still getting special chars in the output. As shown below:The first 2 times I run the open command I get sent two these two urls respectively:You can see the special chars being tacked onto the urls despite being piped through cut, or changing the color settings. This is confirmed with the od command:  ~  apm show vim-mode | grep https | cut -d' ' -f2 | od -atx10000000  esc   [   4   m   h   t   t   p   s   :   /   /   g   i   t   h           1b  5b  34  6d  68  74  74  70  73  3a  2f  2f  67  69  74  680000020    u   b   .   c   o   m   /   a   t   o   m   /   v   i   m   -           75  62  2e  63  6f  6d  2f  61  74  6f  6d  2f  76  69  6d  2d0000040    m   o   d   e esc   [   2   4   m  nl           6d  6f  64  65  1b  5b  32  34  6d  0a   ~  apm show vim-mode | grep --color=none https | cut -d' ' -f2 | od -atx1 0000000  esc   [   4   m   h   t   t   p   s   :   /   /   g   i   t   h            1b  5b  34  6d  68  74  74  70  73  3a  2f  2f  67  69  74  68 0000020    u   b   .   c   o   m   /   a   t   o   m   /   v   i   m   -            75  62  2e  63  6f  6d  2f  61  74  6f  6d  2f  76  69  6d  2d 0000040    m   o   d   e esc   [   2   4   m  nl            6d  6f  64  65  1b  5b  32  34  6d  0a 0000052The next two outputs try to use awk to strip off the url from apm however they also introduce special chars, and the open command then tries to open them as files. This is confirmed with od:  ~  apm show vim-mode | awk -F' ' '/http/ {print $2}' | od -atx10000000  esc   [   4   m   h   t   t   p   s   :   /   /   g   i   t   h           1b  5b  34  6d  68  74  74  70  73  3a  2f  2f  67  69  74  680000020    u   b   .   c   o   m   /   a   t   o   m   /   v   i   m   -           75  62  2e  63  6f  6d  2f  61  74  6f  6d  2f  76  69  6d  2d0000040    m   o   d   e esc   [   2   4   m  nl           6d  6f  64  65  1b  5b  32  34  6d  0aThe solution has been to use a lovely sed oneliner, sed -r s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g that succeeds at stripping off all the special chars. The final open command uses this oneliner and succeeds at going to https://github.com/atom/vim-mode as expected. This is confirmed by od:  ~  apm show vim-mode | awk -F' ' '/http/ {print $2}' | sed -r s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g | od -atx10000000    h   t   t   p   s   :   /   /   g   i   t   h   u   b   .   c           68  74  74  70  73  3a  2f  2f  67  69  74  68  75  62  2e  630000020    o   m   /   a   t   o   m   /   v   i   m   -   m   o   d   e           6f  6d  2f  61  74  6f  6d  2f  76  69  6d  2d  6d  6f  64  650000040   nl           0a0000041So this leaves some questions:Why isn't the grep --color=none working?Why are my various other utils tacking on special chars?I suspect it has something to do with my shell settings. I'm using zim with the gitster themeeditsetting TERM=dumb appears to have no affect:  github-application master  diff <(TERM=dumb apm show vim-mode | od -atx1) <(apm show vim-mode | od -atx1)  github-application master setting NPM_CONFIG_COLOR=false also appears to have no affect:  ~/w/s/g/m/todo master  diff <(NPM_CONFIG_COLOR=false apm show vim-mode | od -atx1) <(apm show vim-mode | od -atx1)  ~/w/s/g/m/todo master I think it's because of the underline in the url. I've been exploring it further in another question
Why is my string changing in this pipeline?
atom
It seems that the special chars are being inserted by apm.   ~  apm show vim-mode | grep https | cut -d' ' -f2 | od -atx10000000  esc   [   4   m   h   t   t   p   s   :   /   /   g   i   t   h           1b  5b  34  6d  68  74  74  70  73  3a  2f  2f  67  69  74  680000020    u   b   .   c   o   m   /   a   t   o   m   /   v   i   m   -           75  62  2e  63  6f  6d  2f  61  74  6f  6d  2f  76  69  6d  2d0000040    m   o   d   e esc   [   2   4   m  nl           6d  6f  64  65  1b  5b  32  34  6d  0a   ~  apm show vim-mode | grep --color=none https | cut -d' ' -f2 | od -atx1 0000000  esc   [   4   m   h   t   t   p   s   :   /   /   g   i   t   h            1b  5b  34  6d  68  74  74  70  73  3a  2f  2f  67  69  74  68 0000020    u   b   .   c   o   m   /   a   t   o   m   /   v   i   m   -            75  62  2e  63  6f  6d  2f  61  74  6f  6d  2f  76  69  6d  2d 0000040    m   o   d   e esc   [   2   4   m  nl            6d  6f  64  65  1b  5b  32  34  6d  0a 0000052  ~  apm show vim-mode | od -atx10000000  esc   [   3   6   m   v   i   m   -   m   o   d   e esc   [   3           1b  5b  33  36  6d  76  69  6d  2d  6d  6f  64  65  1b  5b  330000020    9   m  nl     94  9c     94  80     94  80  sp esc   [   3           39  6d  0a  e2  94  9c  e2  94  80  e2  94  80  20  1b  5b  330000040    3   m   0   .   6   5   .   1 esc   [   3   9   m  nl     94           33  6d  30  2e  36  35  2e  31  1b  5b  33  39  6d  0a  e2  940000060   9c     94  80     94  80  sp esc   [   4   m   h   t   t   p           9c  e2  94  80  e2  94  80  20  1b  5b  34  6d  68  74  74  700000100    s   :   /   /   g   i   t   h   u   b   .   c   o   m   /   a           73  3a  2f  2f  67  69  74  68  75  62  2e  63  6f  6d  2f  610000120    t   o   m   /   v   i   m   -   m   o   d   e esc   [   2   4           74  6f  6d  2f  76  69  6d  2d  6d  6f  64  65  1b  5b  32  340000140    m  nl     94  9c     94  80     94  80  sp   A   d   d  sp           6d  0a  e2  94  9c  e2  94  80  e2  94  80  20  41  64  64  200000160    v   i   m  sp   m   o   d   a   l  sp   c   o   n   t   r   o           76  69  6d  20  6d  6f  64  61  6c  20  63  6f  6e  74  72  6f0000200    l  nl     94  9c     94  80     94  80  sp   5   0   3   8           6c  0a  e2  94  9c  e2  94  80  e2  94  80  20  35  30  33  380000220    6   1  sp   d   o   w   n   l   o   a   d   s  nl     94  94           36  31  20  64  6f  77  6e  6c  6f  61  64  73  0a  e2  94  940000240      94  80     94  80  sp   1   0   1   4  sp   s   t   a   r           e2  94  80  e2  94  80  20  31  30  31  34  20  73  74  61  720000260    s  nl  nl   R   u   n  sp   `   a   p   m  sp   i   n   s   t           73  0a  0a  52  75  6e  20  60  61  70  6d  20  69  6e  73  740000300    a   l   l  sp   v   i   m   -   m   o   d   e   `  sp   t   o           61  6c  6c  20  76  69  6d  2d  6d  6f  64  65  60  20  74  6f0000320   sp   i   n   s   t   a   l   l  sp   t   h   i   s  sp   p   a           20  69  6e  73  74  61  6c  6c  20  74  68  69  73  20  70  610000340    c   k   a   g   e   .  nl  nl           63  6b  61  67  65  2e  0a  0a0000350with e esc   [   2   4 being the specific lines of interest. This is confirmed by switching to bash and getting the same result:bash-3.2# apm show vim-mode | grep https | cut -d' ' -f2 | od -atx10000000  esc   [   4   m   h   t   t   p   s   :   /   /   g   i   t   h           1b  5b  34  6d  68  74  74  70  73  3a  2f  2f  67  69  74  680000020    u   b   .   c   o   m   /   a   t   o   m   /   v   i   m   -           75  62  2e  63  6f  6d  2f  61  74  6f  6d  2f  76  69  6d  2d0000040    m   o   d   e esc   [   2   4   m  nl           6d  6f  64  65  1b  5b  32  34  6d  0aThanks @muru for the tip!