Hi,
When I do a man and save it into a file, I end up getting a lot of control characters. How can I remove them??
I tried this:
/1,$ s/^H//g
But I get an error saying "no previous regular expression".
Can someone help me with this.
And since % is the same as 1,$, I like:
:%s/.^H//g
As ganti (almost) points out the ^H a control-v and a control-h.
And you need that dot. man is using stuff like "_^Hx" to output an underscore, then a backspace and finally an "x". On some devices this will result in an underlined x. If that's not possible, the x will overwrite the underscore. That's why you need to delete the character comes before the ^H.
I presume, you want to save your man pages for future reference or for printing purpose.What I would suggest is to try the following command:
# man ls | col -b > filename
where,
ls - is the command whose man pages are required.
filename - is the name of the file to be saved.