Save command line output to a file without any graphics or special characters I want to save the command line output data in a text file. I am running macOS High Sierra 10.13.6. The problem is, it has some graphical output which I don't want to store. What I need is, only the  strings and their corresponding values. Could you help me please?

The shell command I am running is: 

pwmetrics http://www.cnn.com --runs=1

And the output shown in the Terminal is:



This tool to generate web page performance metrics is open source. Here is the error I am getting while I try to save my code:



And the o.txt file contains nothing.

The shell command I have tried so far are:

pwmetrics http://www.ieee.org --runs=2 &amp;&gt; /Users/ssr/Desktop/o.txt
pwmetrics http://www.ieee.org 2&gt;/dev/null | tee /Users/ssr/Desktop/o.txt
pwmetrics http://www.ieee.org yes&gt;/dev/null | tee /Users/ssr/Desktop/o.txt
You’ve got several options with that tool.


Output JSON and parse that
Upload to Google Sheets and export as CSV the text you need
Use a tool to strip the ANSI escape codes that prettify (in the opinion of some) and color the text - one package to strip ANSI is https://github.com/chalk/strip-ansi
Use other tools to strip these out by piping the output or saving it to a file - https://unix.stackexchange.com/questions/4527/program-that-passes-stdin-to-stdout-with-color-codes-stripped or https://superuser.com/questions/380772/removing-ansi-color-codes-from-text-stream
Trying to set your terminal type to TERM=dumb (like Can&#39;t plot with gnuplot on my Mac) 
forking that project and changing the code so the ANSI escape values are nothing. (Lines 4-8 here https://github.com/paulirish/pwmetrics/blob/master/lib/utils/messages.ts or perhaps a few lines down where those variables are used to construct the output)


I would also tell the program to write your output file so you get a clearer view without needing to debug file handling and pipes in bash (assuming that’s not your strength here today).