Entry
TSE: File: Filter: Linux: Change: Man: How to change 'man' files to readable text files using TSE?
Sep 19th, 2003 08:36
Knud van Eeden,
----------------------------------------------------------------------
--- Knud van Eeden --- 18 September 2003 - 04:18 pm ------------------
TSE: File: Filter: Linux: Change: Man: How to change 'man' files to
readable text files using TSE?
Steps: Overview:
1. -Create a man file in Linux
e.g. type some command using man in a Linux console,
then redirect its output to some text file:
man fstab >/home/myfilename.man
2. -Then transfer this file from Linux to Windows
(use e.g. ftp)
3. -Load your man file
e.g.
EditFile( 'myfilename.man' )
4. -Run this macro
--- cut here ---------------------------------------------------------
proc Main()
integer n
string input[255], output[255]
IF NOT IsBlockInCurrFile()
Warn( "Convert man file to text: please mark a block first" )
RETURN()
ENDIF
GotoBlockBegin()
REPEAT
input = GetText(1, CurrLineLen())
output = ""
n = 1 - 1
REPEAT
n = n + 1
case input[n]
when chr(0x08)
IF input[n-1] == "_"
output = SubStr( output, 1, Length( output ) - 1 ) //
remove the last '_' character from the output string
ELSE
n = n + 1 // skip the current and next character
ENDIF
otherwise
output = output + input[n]
endcase
UNTIL n >= Length(input)
BegLine()
DelToEol()
InsertText( output, _INSERT_ )
UNTIL NOT Down() OR ( NOT IsCursorInBlock() )
//
// remove 'ΓÇÖ'
LReplace( "ΓÇÖ", "", "ngl" )
//
// remove 'ΓÇÿ'
LReplace( "ΓÇÿ", "", "ngl" )
end
<f12> Main()
--- cut here ---------------------------------------------------------
5. -Highlight in the file what you want to convert
(e.g. highlight the whole file)
6. -Press <F12> to run this macro, and to remove
the formatting characters from the text
7. -Possibly save the result with another filename
---
Internet: see also:
How to view 'man' files using TSE?
http://www.faqts.com/knowledge_base/view.phtml/aid/24459/fid/1220
How to automate getting 'man' output?
http://www.faqts.com/knowledge_base/view.phtml/aid/24517/fid/1220
----------------------------------------------------------------------