Not sure whether there are existing similar questions already. Sometimes we need to execute "top" for once and redirect its out to a file, such as:
top -n 1 -o %CPU > top.log
But there will be messy code in top.log:
^[[?1h^[=^[[?25l^[[H^[[2J^[(B^[[mtop - 16:27:45 up 916 days, 17:43, 152 users, load average: 5.51, 5.39, 5.42^[(B^[[m^[[39;49m^[(B^[[m^[[39;49m^[[K
How to fix it?