How do I paste output from the script command (typescript; "man script") so that it's more readable?
Script started on 2017-10-27 06:20:56-0700
]0;thufir@dur: ~/IdeaProjects[01;32mthufir@dur[00m:[01;34m~/IdeaProjects[00m$
]0;thufir@dur: ~/IdeaProjects[01;32mthufir@dur[00m:[01;34m~/IdeaProjects[00m$ tree
[01;34m.[00m
├── kotlin
└── [01;34mkotlinHelloWorld[00m
├── kotlinHelloWorld.iml
├── [01;34mout[00m
│ └── [01;34mproduction[00m
│ └── [01;34mkotlinHelloWorld[00m
└── [01;34msrc[00m
└── Main.kt
5 directories, 3 files
]0;thufir@dur: ~/IdeaProjects[01;32mthufir@dur[00m:[01;34m~/IdeaProjects[00m$
]0;thufir@dur: ~/IdeaProjects[01;32mthufir@dur[00m:[01;34m~/IdeaProjects[00m$ cat kotlinHelloWorld/src/Main.kt
class Main {
fun main(args: Array<String>) {
println("Hello, world!")
}
}]0;thufir@dur: ~/IdeaProjects[01;32mthufir@dur[00m:[01;34m~/IdeaProjects[00m$
]0;thufir@dur: ~/IdeaProjects[01;32mthufir@dur[00m:[01;34m~/IdeaProjects[00m$ exit
exit
Script done on 2017-10-27 06:21:19-0700
The gibberish (?) is reflective of, in this case, gnome-terminal color. Yes, by using a different shell, different console, etc it's possible to not generate that "gibberish". The question is how to nicely either get the script command to not record them, or get the pastebin utility (or similar, such as gist-paste) to handle them "nicely".
firstly, thank you for the responses. Secondly, I hope that this doesn't muddy the waters:
thufir@dur:~$
thufir@dur:~$ script trying_to_eliminate_control_chars.txt
Script started, file is trying_to_eliminate_control_chars.txt
thufir@dur:~$
thufir@dur:~$ echo "hi"
hi
thufir@dur:~$
thufir@dur:~$ echo "hi"
hi
thufir@dur:~$
thufir@dur:~$ echo "hmm"
hmm
thufir@dur:~$
thufir@dur:~$ exit
exit
Script done, file is trying_to_eliminate_control_chars.txt
thufir@dur:~$
thufir@dur:~$ cat trying_to_eliminate_control_chars.txt > foo.txt
thufir@dur:~$
thufir@dur:~$ cat foo.txt
Script started on 2017-10-31 17:51:29-0700
thufir@dur:~$
thufir@dur:~$ echo "hi"
hi
thufir@dur:~$
thufir@dur:~$ echo "hi"
hi
thufir@dur:~$
thufir@dur:~$ echo "hmm"
hmm
thufir@dur:~$
thufir@dur:~$ exit
exit
Script done on 2017-10-31 17:51:47-0700
thufir@dur:~$
thufir@dur:~$ cat trying_to_eliminate_control_chars.txt
Script started on 2017-10-31 17:51:29-0700
thufir@dur:~$
thufir@dur:~$ echo "hi"
hi
thufir@dur:~$
thufir@dur:~$ echo "hi"
hi
thufir@dur:~$
thufir@dur:~$ echo "hmm"
hmm
thufir@dur:~$
thufir@dur:~$ exit
exit
Script done on 2017-10-31 17:51:47-0700
thufir@dur:~$
thufir@dur:~$ pastebin foo.txt
pastebin: command not found
thufir@dur:~$
thufir@dur:~$ pastebinit foo.txt
http://paste.ubuntu.com/25862228/
thufir@dur:~$
While you may naively expect the above paste not to have control characters, it does. This is because the terminal itself (or so I infer) is handling/hiding them.
Very low-level text files, etc, at play. Plus very detailed knowledge of how terminal emulation works. A bit beyond me, frankly.
