I am using script-command
to save the output of terminal to file.
but, it gives some extra characters like square-like
characters and other text encrypted characters.
man script
command tells, by using -q
flag/option, it gives quite an output, without writing start and done messages to standard output, but it won't remove extra characters.
how can I get following:
1) make output file exactly same as of terminal output, removing extra characters.
2) In generated file, due to plain text-without color(unlike terminal), I can't figure-out directly input commands
, because output and command I entered appears of same font,
can I make command as bold or easily recognizable than rest output?
If you checkout the:
You can see that:
What I came up with is a combination of
tr
andsed
to get what we want.Most of those characters are indicating colors, to remove most of them we can use this
sed
command from here:However it's still not enough... because as we saw in script's
man
there are other not printable characters we should get rid of. To remove those we can simply use:Now we are almost there, the other problem in my test was that prompt being repeated twice, so to remove that start
script
withdump
andTERM
's valueTERM=dump
.Final result:
To capture commands:
To remove unnecessary characters:
For second part of your question, the output file is just a text file so we can't change the font or size of specific lines of it, however your output contains your prompt so you'll know which line is the command and which one is the output.