home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume9 / pep / part02 < prev    next >
Text File  |  1989-12-29  |  31KB  |  1,076 lines

  1. Newsgroups: comp.sources.misc
  2. organization: gisle@ifi.uio.no
  3. subject: v09i093: PEP filter program [ part 2 of 5 ]
  4. from: gisle@ifi.uio.no (Gisle Hannemyr)
  5. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  6.  
  7. Posting-number: Volume 9, Issue 93
  8. Submitted-by: gisle@ifi.uio.no (Gisle Hannemyr)
  9. Archive-name: pep/part02
  10.  
  11. # This is a shell archive [ part 2 of of 5 ]
  12. # Remove everything above and including the cut line.
  13. # Then run the rest of the file through /bin/sh (not csh).
  14. #--cut here-----cut here-----cut here-----cut here-----cut here-----cut here--#
  15. #!/bin/sh
  16. # shar: Shell Archiver
  17. # Execute the following text with /bin/sh to create the file(s):
  18. #    Doc/pep.1l
  19. # This archive created: Fri Dec 29 14:42:42 1989
  20. # Wrapped by: Gisle Hannemyr (gisle@ifi.uio.no)
  21. echo shar: extracting pep.1l
  22. sed 's/^XX//' << \SHAR_EOF > pep.1l
  23. XX.\" @(#)pep.1l 2.0 89/12/10 [gh]
  24. XX.\" Usage:
  25. XX.\"    nroff -man pep.1l
  26. XX.TH PEP 1L "28 December 1989" "Version 2.1"
  27. XX.SH NAME
  28. XXpep \- a file detergent
  29. XX.SH SYNOPSIS
  30. XX.B pep
  31. XX[
  32. XX.B \-a
  33. XX]
  34. XX[
  35. XX.B \-b
  36. XX]
  37. XX[
  38. XX.B \-c
  39. XX[
  40. XX.I size
  41. XX]]
  42. XX[
  43. XX.B \-d + | \-
  44. XX]
  45. XX.if n .ti +5
  46. XX[
  47. XX.B "\-e [ 0 | 1 | 2"
  48. XX]]
  49. XX[
  50. XX.B \-g
  51. XX.I file
  52. XX]
  53. XX[
  54. XX.B \-h
  55. XX]
  56. XX[
  57. XX.B \-i + | \-
  58. XX]
  59. XX.if n .ti +5
  60. XX[
  61. XX.B \-k + | \-
  62. XX]
  63. XX[
  64. XX.B \-m + | \-
  65. XX]
  66. XX[
  67. XX.B \-o
  68. XX[
  69. XX.B b
  70. XX]]
  71. XX[
  72. XX.B \-p
  73. XX]
  74. XX.if n .ti +5
  75. XX[
  76. XX.B \-s
  77. XX[
  78. XX.I size
  79. XX]]
  80. XX[
  81. XX.B \-t
  82. XX[
  83. XX.I size
  84. XX]]
  85. XX[
  86. XX.B \-u
  87. XX.I terminator
  88. XX]
  89. XX[
  90. XX.B \-v
  91. XX]
  92. XX.if n .ti +5
  93. XX[
  94. XX.B \-w + | \-
  95. XX]
  96. XX[
  97. XX.B \-x
  98. XX]
  99. XX[
  100. XX.B \-z
  101. XX]
  102. XX[
  103. XX.I filename
  104. XX.B .\|.\|.
  105. XX]
  106. XX.SH DESCRIPTION
  107. XX.LP
  108. XX.B Pep
  109. XXis a filter program to "clean" files.  It is named after a
  110. XXpopular Norwegian detergent.
  111. XX.PP
  112. XX.B Pep
  113. XXmay be used to remove control characters, strip parity bits,
  114. XXinterpret ANSI escape sequences, compress tabulation,
  115. XXextract strings and convert character sets.  Nine out of ten hackers
  116. XXprefer "pep" to soap (which may very well explain why some of
  117. XXthem smell the way they do).
  118. XX.PP
  119. XX.B Pep
  120. XXis a filter.  Its default operation is to read from standard input
  121. XX(the keyboard) and write on standard output (the terminal).
  122. XX.PP
  123. XXYou may also specify the name of one or more files as the last
  124. XXargument on the command line.  Most versions of
  125. XX.B pep
  126. XX(not the version compiled for the DEC VMS operating system)
  127. XXallow ambiguous filename arguments, were a single
  128. XX.I filename
  129. XXargument may specify several files.
  130. XX.PP
  131. XXYou may instruct
  132. XX.B pep
  133. XXto write the result back onto the original input file with the
  134. XX.B \-o
  135. XXoption.  If you use this option, the original file will be lost.
  136. XXIf you want to keep the original file (something that usually will
  137. XXbe the case when you do things like extracting strings from an
  138. XXexecutable file), you should make a copy of the file before applying
  139. XX.B
  140. XXpep,
  141. XXand filter the copy rather than the original.
  142. XXSome of the functions in
  143. XX.B
  144. XXpep
  145. XX(in particular those selected with the
  146. XX.B \-b
  147. XXand
  148. XX.B \-s
  149. XXoptions) may remove a lot of material from files, and it may be unfortunate if
  150. XXthis happens to the wrong file.  It is probably a good idea to always use
  151. XX.B pep
  152. XXon copies until you have some experience with the various
  153. XX.BR pep \-options.
  154. XXYou may also use the
  155. XX.B b
  156. XXargument on the
  157. XX.B \-o
  158. XXoption to save the original in a .BAK-file.
  159. XX.PP
  160. XXTo get a brief summary of the command line syntax and all the options,
  161. XXyou need to specify the
  162. XX.B \-h
  163. XXoption.  Just type the command:
  164. XX.sp 0.5
  165. XX.RS
  166. XX.B pep \-h
  167. XX.RE
  168. XX.PP
  169. XXfollowed by the RETURN key.  Note that just
  170. XX.B pep
  171. XXwill not give you this summary.  The command:
  172. XX.sp 0.5
  173. XX.RS
  174. XX.B pep
  175. XX.RE
  176. XX.PP
  177. XXwill start
  178. XX.B pep
  179. XXas a filter, and it will just echo back whatever you type, until you
  180. XXtype the end of file character (usually CTRL-D or CTRL-Z).
  181. XX.PP
  182. XXWhen
  183. XX.B pep
  184. XXis running as filter, it is reading from the standard input and
  185. XXwriting to the standard output.  In this state,
  186. XX.B pep
  187. XXwill be very much less verbose than it usually is.  It will still
  188. XXprint error messages, but very little else.  Note that while:
  189. XX.sp 0.5
  190. XX.RS
  191. XX.nf
  192. XX.B pep < foobar.in > foobar.out
  193. XX.B pep \-ob foobar.txt
  194. XX.fi
  195. XX.RE
  196. XX.PP
  197. XXwill do more or less the same job, the first will do it quietly,
  198. XXin the tradition of Unix filters; the latter will print the
  199. XXcopyright notice, a detailed list of the things it will do,
  200. XXand finally a list and line count
  201. XXof all the files it processes as it plods along.
  202. XX.PP
  203. XX.B Pep
  204. XXwill remove some "noise" from files, even if no options are specified.
  205. XXThe following is the default behavior:
  206. XX.RS
  207. XX.TP 3
  208. XX\(bu
  209. XXremove trailing spaces;
  210. XX.TP 3
  211. XX\(bu
  212. XXterminate each line with the canonical line terminator (usually LF, CR or both);
  213. XX.TP 3
  214. XX\(bu
  215. XXremove underlining intended for backspacing printers;
  216. XX.TP 3
  217. XX\(bu
  218. XXremove control characters (character codes < 32) except canonical line
  219. XXterminator, FF and TAB;
  220. XX.TP 3
  221. XX\(bu
  222. XXbreak the line before the FF if a line contains an FF anywhere except in the
  223. XXfirst column.
  224. XX.RE
  225. XX.PP
  226. XXIf you want to check what
  227. XX.B pep
  228. XXactually intend to do to your file before it does it, you may make it
  229. XXpause with the
  230. XX.B \-p
  231. XXoption.  For example:
  232. XX.sp 0.5
  233. XX.RS
  234. XX.B pep \-p foobar.txt
  235. XX.RE
  236. XX.PP
  237. XXwill make
  238. XX.B pep
  239. XXstop after displaying a list of the conversions it will apply to the
  240. XXfile.  The user is prompted and may choose to proceed
  241. XX(hitting the RETURN key), or abort
  242. XXthe program without doing anything (hitting CTRL-C).
  243. XX.PP
  244. XXThe user may want other conversions than the default action described
  245. XXabove.  A number of conversion functions may be selected by specifying one or
  246. XXmore options on the command line.
  247. XX.PP
  248. XXSome of the options require an additional argument switch, and must be
  249. XXfollowed by a "+" or a "\-", other options
  250. XXrequire a number or a filename argument.
  251. XXMost of the options may be combined with other options, but a few are
  252. XXmutually exclusive.  If the user specifies invalid options or option
  253. XXarguments, then
  254. XX.B pep
  255. XXwill abort with an error message and return an error exit code on
  256. XXoperating systems that support exit codes.
  257. XX.SH OPTIONS
  258. XX.TP
  259. XX.B \-a
  260. XXWrite out information about
  261. XX.B
  262. XXpep.
  263. XX.TP
  264. XX.B \-b
  265. XXRemove all characters not in the original 7-bit character set (ISO 646).
  266. XXI.e. remove the characters which are encoded from 128 to 255.
  267. XX(If this option is combined with the
  268. XX.B \-x
  269. XXoption, it will print the codes for these characters in hexadecimal
  270. XXinstead of removing them.)
  271. XXThe
  272. XX.B \-b
  273. XXoption is powerful, and may remove a lot of bytes if you use it
  274. XXon the wrong file.  Only use it if you know exactly how the eight bit is
  275. XXused in the file you intend to filter.  Also note that the options
  276. XX.B i, d, k, g, m, w
  277. XXor
  278. XX.B z
  279. XXin most cases are better suited to
  280. XXprocess files where the eight bit is set.
  281. XX.TP
  282. XX\fB\-c \fR[ \fIsize \fR]
  283. XXCompress space into tabulation.  I.e. insert TAB characters when
  284. XXreplacing a run of two or more SPACE characters would produce a
  285. XXsmaller output file.
  286. XXThis function is the opposite of the function invoked with the
  287. XX.B \-t
  288. XXoption.
  289. XX.IP
  290. XXThe default tabulation size is 8,
  291. XXbut you may specify any other tabulation with the optional numeric
  292. XXargument.
  293. XX.TP
  294. XX.B \-d + | \-
  295. XXConvert to or from the ISO 8859/1 8 bit character set and the Norwegian
  296. XXversion of the ISO 646 7 bit character set.  If the argument is "+",
  297. XXthe file is converted
  298. XX.I to
  299. XXISO 8859/1.  If the argument is "\-",
  300. XXthe file is converted
  301. XX.I from
  302. XXISO 8859/1.  The ISO 8859/1 character set is also
  303. XXknown as the  "DEC Multinational Character Set".
  304. XX.TP
  305. XX\fB\-e \fR[ \fB0 | 1 | 2 \fR]
  306. XXInterpret ANSI screen control sequences (also known as ANSI ESCAPE
  307. XXsequences).  This function makes
  308. XX.B pep
  309. XXemulate cursor positioning and other functions on an ANSI-terminal.
  310. XX.IP
  311. XX.B Pep
  312. XXwill complain about "strange" (i.e. implementation dependent) use of
  313. XXANSI escape sequences.
  314. XX.IP
  315. XX.B Pep
  316. XXwill normally save a screen image on the output file when one of
  317. XXtwo events occur:  1) When the screen is full and scrolls up;
  318. XXor 2) just before a screen image is erased with the "erase screen"
  319. XXANSI screen control sequence.  In some cases important fields
  320. XXon the screen will be overwritten or erased.  There
  321. XXis no good solution to this
  322. XXproblem, but
  323. XX.B pep
  324. XXprovides the user with some opportunity to guard against overwriting
  325. XXand erasure.  This is done by specifying an additional numeric argument
  326. XXto the
  327. XX.B \-e
  328. XXoption.  This numeric indicate the level of protection
  329. XXand is interpreted as follows:
  330. XX.sp 0.5
  331. XX.RS
  332. XX.RS
  333. XX.TP 3
  334. XX0:
  335. XXno protection \(em fields may be erased and overwritten
  336. XX(this is the default);
  337. XX.TP
  338. XX1:
  339. XXsequences that erase fields are ignored;
  340. XX.TP
  341. XX2:
  342. XXsequences that erase or overwrite fields are ignored.
  343. XX.RE
  344. XX.RE
  345. XX.TP
  346. XX\fB\-g \fIfile \fR
  347. XXRead the conversion table from a file.  The name of the file must be
  348. XXappended as the argument to this option.
  349. XX.IP
  350. XXThe file itself is a standard ASCII text file where each line should
  351. XXcontain two decimal numbers.  The first number is the character code
  352. XXto convert
  353. XX.I from,
  354. XXand the second number is the character code to convert
  355. XX.I to.
  356. XXA "#" character and all the following characters up to a NEWLINE is
  357. XXconsidered a comment, and is ignored.  Comments are however echoed
  358. XXon the screen along with the other comments
  359. XX.B pep
  360. XXmakes, unless the comment line starts with a "##".
  361. XX.IP
  362. XXBelow is an example of how such a conversion file may look:
  363. XX.sp 0.5
  364. XX.PP
  365. XX.ft B
  366. XX.nf
  367. XX.RS
  368. XX.RS
  369. XX# Convert from Macintosh to IBM-PC
  370. XX##This line is not echoed on the screen.
  371. XX# MAC IBM
  372. XX  174 146
  373. XX  175 157
  374. XX  129 143
  375. XX  190 145
  376. XX  191 155
  377. XX  140 134
  378. XX# EOF
  379. XX.RE
  380. XX.RE
  381. XX.fi
  382. XX.ft R
  383. XX.TP
  384. XX.B \-h
  385. XXWrite a brief summary of
  386. XX.B pep
  387. XXoptions, and exit.
  388. XX.TP
  389. XX.B \-i + | \-
  390. XXConvert to or from the IBM 8 bit character set (Code Page 850 Multilingual)
  391. XXand the Norwegian
  392. XXversion of the ISO 646 7 bit character set.  If the argument is "+",
  393. XXthe file is converted
  394. XX.I to
  395. XXCP 850.  If the argument is "\-",
  396. XXthe file is converted
  397. XX.I from
  398. XXCP 850.  The CP 850 character set (or a subset of it)
  399. XXis what is used in the IBM PC, AT, and PS/2 series of
  400. XXcomputers and their clones.  Note that some machines with
  401. XXAmerican PROMs have a yen- and cent character in
  402. XXthe position rightfully belonging to upper and lower case
  403. XXversions of the Norwegian character
  404. XXwritten as an "o" with a slash across it (often referred to as
  405. XX.IR oslash ).
  406. XX.TP
  407. XX.B \-k + | \-
  408. XXConvert to or from a 8 bit character set and the
  409. XXISO 646 7 bit character set.  This is a modified version
  410. XXof the
  411. XX.B \-i
  412. XXfunction, hacked to preserve both the
  413. XX.I backslash
  414. XXcharacter and the upper case
  415. XX.I oslash
  416. XXcharacter as required by, among others, the "KnowledgeMan" package.  These
  417. XXcharacters share the same code (92 decimal) in 7 bit ISO 646,
  418. XXbut uses different codes (92 is backslash, 157 is oslash) in
  419. XX8 bit CP 850.  To get around this, two backslashes in ISO 646
  420. XXwill be converted to the upper case oslash character in CP 850, while
  421. XXa single backslash will be preserved \(em and vice versa.
  422. XX.IP
  423. XXIf this option is combined with the
  424. XX.B \-d
  425. XXor
  426. XX.B \-m
  427. XXoption, the DEC/ISO or the Macintosh character sets is used as base
  428. XXinstead of CP 850.
  429. XX.TP
  430. XX.B \-m + | \-
  431. XXConvert to or from the Apple Macintosh 8 bit character set and the Norwegian
  432. XXversion of the ISO 646 7 bit character set.  If the argument is "+",
  433. XXthe file is converted
  434. XX.I to
  435. XXthe Macintosh character set; if the argument is "\-",
  436. XXthe file is converted
  437. XX.I from
  438. XXthe Macintosh character set.
  439. XXSee description of
  440. XX.B \-v
  441. XXoption below and
  442. XXnote in "bugs" section below about treatment of "end-of-line" and
  443. XX"end-of-paragraph".
  444. XX.TP
  445. XX\fB\-o \fR[ \fBb \fR]
  446. XX.B Pep
  447. XXwill usually write the result of conversions on the standard output
  448. XX.I (stdout).
  449. XXThis option instead instructs
  450. XX.B pep
  451. XXto replace each named input file with a file containing the result
  452. XXof filtering the file through
  453. XX.B pep.
  454. XXIf the option is augmented with the argument
  455. XX.B b
  456. XX(i.e.
  457. XX.BR \-ob ),
  458. XXthen
  459. XX.B pep
  460. XXwill create a backup copy of the original input file on a file
  461. XXwith extension .BAK.  If you just specify
  462. XX.B \-o
  463. XXthe original file is deleted.
  464. XX.IP
  465. XXThe VMS version of
  466. XX.B pep
  467. XXwill always run as if this option was specified.  This is because
  468. XXVMS does not support useful redirection or pipes.  Therefore, it is never
  469. XXnecessary to specify the
  470. XX.B \-o
  471. XXoption under VMS, but users should still specify
  472. XX.B \-ob
  473. XXif they want a backup copy of the original input file.
  474. XX.TP
  475. XX.B \-p
  476. XXWrite out a brief description the conversion functions that
  477. XXwill be activated by the current
  478. XXset of options, and pause.  The user may review the list of
  479. XXconversion functions and abort (by hitting CTRL-C) if they do not have
  480. XXthe intended effect.
  481. XX.TP
  482. XX\fB\-s \fR[ \fIsize \fR]
  483. XXFind strings in extremely "noisy" files.
  484. XX.IP
  485. XX.BR Pep 's
  486. XXconcept of a string is that it is a sequence of "printable" characters
  487. XXof a certain length.  The default minimum length of this sequence is
  488. XX4, but this may be changed by the user by supplying an optional
  489. XXnumeric argument that becomes the minimum length of the sequence.
  490. XX.IP
  491. XXThe default definition of a "printable" character is a symbol with
  492. XXencoding above 31 decimal (i.e. 32 to 255) plus certain
  493. XXcommon control characters (TAB, CR and LF).  This definition
  494. XXis almost always too liberal, and will include a lot of "noise" in
  495. XXthe output.  One or more of the options
  496. XX.B \-b, \-d, \-i, \-m
  497. XXor
  498. XX.B \-z
  499. XXshould be specified in addition to
  500. XX.B \-s
  501. XXin order to narrow the definition and the search space.
  502. XXIn my experience, the
  503. XX.B \-b
  504. XXoption is a particularly
  505. XXuseful additional filter when searching for strings.
  506. XX.TP
  507. XX\fB\-t \fR[ \fIsize \fR]
  508. XXExpand tabulation, replacing the TAB character with a suitable number
  509. XXof spaces.  The default tabulation size is 8, but the optional
  510. XXnumeric argument
  511. XX.I size
  512. XXmay be used to set tabulation to any desired size.
  513. XX.TP
  514. XX\fB\-u r | n | s | - | # | \fInumber \fR
  515. XX.BR Pep 's
  516. XXdefault behaviour is to terminate lines with whatever is the
  517. XXcanonical line terminator (the standard way to terminate
  518. XXa text line) on the assumed target system for the output file.
  519. XXThis means CR/LF on a microcomputer system, LF on a UNIX system,
  520. XXand CR if the target is a Macintosh).  The assumed target system
  521. XXis usually the system
  522. XX.B pep
  523. XXis running on, unless you request folding to the character set
  524. XXof another computer system.  Then, that computer system becomes
  525. XXthe assumed target.
  526. XX.IP
  527. XXThe
  528. XX.B \-u
  529. XXoption allows you to override this assumption.
  530. XXYou do this by specifying explicit (in decimal) the numeric ASCII
  531. XXvalue of the end of line character you want in your output file.
  532. XXFor example, to make sure
  533. XXlines are terminated by LF (the standard for UNIX text files),
  534. XXyou may use
  535. XX.BR \-u10 ,
  536. XXbecause 10 is the ASCII value of the newline (LF) control character.
  537. XXInstead of a numeric argument, you may specify
  538. XX.BR r ,
  539. XXfor carrige return (CR),
  540. XX.BR n ,
  541. XXfor newline (LF),
  542. XX.BR s ,
  543. XXfor record separator (RS), the symbol
  544. XX.BR - ,
  545. XXfor no line terminator, or the symbol
  546. XX.B #
  547. XXto get carrige return followed by a newline (CR/LF).
  548. XX.TP
  549. XX.B \-v
  550. XXNormally,
  551. XX.B pep
  552. XXwill terminate each line with the canonical line terminator.
  553. XXSome typesetting programs and word processors, however, require
  554. XXthat no hard line terminator is present within a paragraph, and
  555. XXthat only paragraphs are hard terminated.  If you want to
  556. XXimport a file to such a typesetting program or word processor,
  557. XXyou may instruct
  558. XX.B pep
  559. XXto terminate paragraphs
  560. XX.I only
  561. XXwith this option.
  562. XX.IP
  563. XXSee note in "bugs" section below about treatment of "end-of-line" and
  564. XX"end-of-paragraph".
  565. XX.TP
  566. XX.B \-w + | \-
  567. XXThis slightly obsolete option converts files to and from the
  568. XXWordStar version 3.2 "document" mode.  If the argument is "+",
  569. XXthe file is converted
  570. XX.I to
  571. XXWordStar document mode; if the argument is "\-",
  572. XXthe file is converted
  573. XX.I from
  574. XXWordStar document mode into plain ASCII text.
  575. XX.TP
  576. XX.B \-x
  577. XXExpand unprintable characters.  This option
  578. XXwill make
  579. XX.B pep
  580. XXexpand the characters it would otherwise remove from the file by
  581. XXprinting the character encoding of these characters in
  582. XXhexadecimal between angle brackets.
  583. XX.TP
  584. XX.B \-z
  585. XXZero the eight bit (a.k.a. the parity bit) on all characters in the file.
  586. XX.SH ENVIRONMENT
  587. XX.PP
  588. XX.B Pep
  589. XXknows a single environment variable:
  590. XX.BR PEP ,
  591. XXwhich may be
  592. XXused to indicate the lookup path for files with conversion
  593. XXtables.  Below is some examples on how to set this in some
  594. XXoperating systems:
  595. XX.sp 0.5
  596. XX.RS
  597. XX.nf
  598. XX\fBset PEP=c:\eusr\elib                \fR(MS-DOS)
  599. XX\fBsetenv PEP /usr/local/lib                \fR(UNIX)
  600. XX\fBdefine PEP "DISK_USR:<LOCAL.LIB>"        \fR(VMS)
  601. XX.fi
  602. XX.RE
  603. XX.PP
  604. XXThe command to set this environment variable should usually be
  605. XXpart of the command file that is read during login (this may
  606. XXbe named
  607. XX.B "AUTOEXEC.BAT, LOGIN.COM, .profile"
  608. XXor
  609. XX.B .login
  610. XXdepending upon your choice of operating system.  Please note
  611. XXthat environment variables do not exist under CP/M.
  612. XX.SH EXAMPLES
  613. XXSome of the examples below use i/o redirection and pipes,
  614. XXas indicated with the symbols ">" and "<" (redirection)
  615. XXand "|" (pipe symbol).  These examples
  616. XXonly apply to operating systems that support
  617. XXredirection and pipes.
  618. XX.PP
  619. XX.TP 3
  620. XX.B pep \-h
  621. XXPrint a quick summary of all available options, and exit.
  622. XX.TP
  623. XX.B "pep"
  624. XXRead input from standard input (the keyboard), and write
  625. XXthe result on standard output (the screen) until the user
  626. XXtypes the end of file character (usually CTRL-D (UNIX) or
  627. XXCTRL-Z (MS-DOS)).  This is of limited practical use by
  628. XXitself, usually this command is inserted into the middle of a
  629. XXcommand where the standard input and standard output are pipes.
  630. XX.TP
  631. XX.B "pep < foo.bar
  632. XXDisplay a slightly cleaned-up version of the file
  633. XX.I foo.bar
  634. XXon the screen.
  635. XX.TP
  636. XX.B "pep < foo.bar > foo.txt"
  637. XXRead the file
  638. XX.I foo.bar,
  639. XXclean it, and write the result on the file
  640. XX.I foo.txt.
  641. XX.TP
  642. XX.B "pep foo.bar > foo.txt"
  643. XXRead the file
  644. XX.I foo.bar,
  645. XXclean it, and write the result on the file
  646. XX.I foo.txt.
  647. XX.TP
  648. XX.B "pep foo1.bar foo2.bar > foo.txt"
  649. XXRead the files
  650. XX.I "foo1.bar"
  651. XXand
  652. XX.I foo2.bar,
  653. XXclean them, and
  654. XXcatenate the result on the file
  655. XX.I foo.txt.
  656. XX.TP
  657. XX.B "pep \-o foo.fil bar.fil"
  658. XXClean the files
  659. XX.I foo.fil
  660. XXand
  661. XX.I bar.fil,
  662. XXreplacing the
  663. XXoriginal files with the cleaned-up versions.
  664. XX.TP
  665. XX.B "pep \-ob foo.fil bar.fil"
  666. XXClean the files
  667. XX.I foo.fil
  668. XXand
  669. XX.I bar.fil,
  670. XXreplacing the
  671. XXoriginal files with the cleaned-up versions.  The original
  672. XXfiles are preserved as
  673. XX.I foo.bak
  674. XXand
  675. XX.I bar.bak.
  676. XX.TP
  677. XX.B "pep \-i+ \-o program.dok"
  678. XXConvert the Norwegian text in the file
  679. XX.I "program.dok"
  680. XXto use
  681. XXthe IBM-PC 8 bit character set.  Please note that this
  682. XXconversion may not be 100 percent correct.  For instance,
  683. XXthe pipe symbol "|" will be converted to the lower case Norwegian
  684. XX.I oslash
  685. XXcharacter.
  686. XXThis is because the pipe symbol and the character share the
  687. XXsame ASCII code (124) in the Norwegian version of the 7-bit character
  688. XXset, but they have different codes when
  689. XXusing 8-bit character sets.
  690. XX.TP
  691. XX.B "pep \-e2 \-o kermit.log"
  692. XXInterpret ANSI screen control sequences in the file
  693. XX.I kermit.log.
  694. XXSet guard to level 2 (no deletion or overwriting).
  695. XX.IP
  696. XXIn this example, it is assumed that the file
  697. XX.I kermit.log
  698. XXis a log record of an on-line session with some Bulletin Board System (BBS).
  699. XXSuch files may be created with the command "log session" in the popular
  700. XX.I kermit
  701. XXcommunication program.  Most other communication programs have
  702. XXsimilar commands.  Many BBSs uses
  703. XXuses ANSI sequences for simple graphics, highlighting and
  704. XXother special effects, and you will get a much more
  705. XXmore readable session log if you run it through
  706. XX.B pep
  707. XXwith the
  708. XX.B \-e
  709. XXoption turned on.
  710. XX.TP
  711. XX.B "test | pep \-e > test.scr"
  712. XXRun the program
  713. XX.I test,
  714. XXand pipe its output to
  715. XX.B pep,
  716. XXwhich interprets any ANSI sequences and store the resulting screen
  717. XXimages in the file
  718. XX.I test.scr.
  719. XXNote that this is only
  720. XXpossible on operating systems that support pipes (i.e. UNIX and MS-DOS).
  721. XX.IP
  722. XXThe screen images will now be on standard text files which have the same
  723. XXgeneral layout as the original screen images.  This may be useful if
  724. XXyou need text versions of the screen images for inclusion in manuals or
  725. XXfor prototypes.
  726. XX.TP
  727. XX.B "nroff \-man \-Tlpr pep.1l | pep > pep.doc"
  728. XXGenerate a plain text version of this manual, without
  729. XXbackspaces or double strikes
  730. XX.RB ( nroff
  731. XXis the standard Unix text formatter).
  732. XX.TP
  733. XX.B "pep \-d- \-o *.txt"
  734. XXConvert all files with extension
  735. XX.B .txt
  736. XXfrom DEC/ISO character set to Norwegian 7-bit ASCII characters.
  737. XX.TP
  738. XX.B "pep \-gibm2mac \-ur \-< foo.ibm > foo.mac"
  739. XXUse the conversion table in the file
  740. XX.I "ibm2mac"
  741. XXto convert
  742. XXthe character set in the file
  743. XX.I foo.ibm.
  744. XXStore the result on the file
  745. XX.I foo.mac,
  746. XXwhere each line should be terminated by a single CR character.
  747. XX.TP
  748. XX.B "pep \-m\- < foo.mac | pep \-i+ > foo.ibm"
  749. XXConvert Apple Macintosh encoded Norwegian characters in the file
  750. XX.I "foo.mac"
  751. XXto IBM-PC (Code Page 850) encoding.  This is an alternative way to
  752. XXaccomplish the same thing as the conversion done in the previous
  753. XXexample.
  754. XX.TP
  755. XX.B "pep \-w- \-o *.*"
  756. XXConvert all files in the current directory from WordStar document
  757. XXmode to 7-bit ASCII.
  758. XX.TP
  759. XX.B "pep \-w+ \-t4 < foo.txt > foo.ws"
  760. XXConvert the file
  761. XX.I "foo.txt"
  762. XXto WordStar document mode format, also expanding tabulation (tabstop = 4)
  763. XXto space characters.  The result is stored on a file named
  764. XX.I foo.ws.
  765. XX.B Pep
  766. XXuses a simple pattern recognition mechanism to recognize pages,
  767. XXparagraphs, soft white space and soft hyphens.  It will probably
  768. XXnot do a 100% conversion, but the file will be much easier to
  769. XXedit in WordStar than the original.
  770. XX.TP
  771. XX.B "pep \-z \-x < foo.dat > foo.dmp"
  772. XXStrip the 8th bit and expand control characters to hex
  773. XXdigits in the file
  774. XX.I foo.dat,
  775. XXand store the result on the file
  776. XX.I foo.dmp.
  777. XX.IP
  778. XXExpanding the unprintable characters to hexadecimal makes it easier to
  779. XXinspect a file in an ordinary text editor, and to post-process it
  780. XXby a customized filter you may create yourself
  781. XXwith the search/replace and macro
  782. XXfacilities found in many editors today.
  783. XX.TP
  784. XX.B "pep \-s6 \-b < pep.exe"
  785. XXExtract "strings" from the file
  786. XX.I pep.exe.
  787. XXThe strings are just listed on standard output (the screen).
  788. XX"Strings" are in this context assumed to be any sequence of characters
  789. XXthat are at least 6 characters long.  The
  790. XX.B \-b
  791. XXoption excludes characters with codes in the range 128 to 255 from
  792. XXthe search.  It is almost always a good idea to combine the
  793. XX.B \-b
  794. XXoption with
  795. XX.B \-s
  796. XXoption, otherwise to much garbage is picked up by the filter.
  797. XX.TP
  798. XX.B "pep \-t4 \-c8 \-o foo.c"
  799. XXIf both tab expansion
  800. XX.B \-t
  801. XXand tab compression
  802. XX.B \-c
  803. XXis specified, then
  804. XX.B pep
  805. XXwill repack the tabulation.  This is useful if you want to convert
  806. XXa file from one tab-size to another (e.g. to convert non-standard
  807. XX4 character tabulation into standard 8 character tabulation).
  808. XXIn this example, two TAB characters in the file
  809. XX.I foo.c
  810. XXare replaced by a single tab character: and any TAB character that cannot be
  811. XXpaired up is replaced by the appropriate number of spaces.
  812. XX.TP
  813. XX.B "pep \-t \-c \-o foo.c"
  814. XXRemove redundant space characters in existing tabulation in the file
  815. XX.I foo.c.
  816. XXWhat happens is that tabulation on each line is first expanded and
  817. XXthen compressed again, which effectively
  818. XXremoves any space characters "inside" a tabulation.
  819. XX.SH DIAGNOSTICS
  820. XX.PP
  821. XXIf you specify an option that
  822. XX.B pep
  823. XXdoes not recognize, then
  824. XX.B pep
  825. XXwill
  826. XXwrite a summary of usage and abort.  Other errors on the
  827. XXcommand line will result in
  828. XX.B pep
  829. XXwriting an error message
  830. XXbefore aborting.
  831. XX.PP
  832. XXOn operating systems that support exit codes,
  833. XX.B pep
  834. XXwill return an exit code upon termination.
  835. XX.PP
  836. XXIf
  837. XX.B pep
  838. XXis interpreting ANSI escape sequences and notices
  839. XXsyntactical or semantical errors in the way they are used, a
  840. XXwarning is printed on the screen, prefixed with the string
  841. XX"ansi:".  This means that it is also possible to use
  842. XX.B pep
  843. XXto check if programs use ANSI sequences in a portable way.
  844. XX.SH FILES
  845. XX.TP 10
  846. XX.B pep, pep.exe, pep.cmd
  847. XXexecutable file (actual name depends upon which operating system you use).
  848. XX.TP
  849. XX.B mac2ibm
  850. XXsmall example of a user supplied conversion table
  851. XXto convert from the Macintosh character set to that used on
  852. XXthe Norwegian version of the original IBM-PC (the sample file
  853. XXonly covers the Norwegian characters \(em to complete it is
  854. XXleft as an exercise to the reader :-) ).
  855. XX.TP
  856. XX.B ibm2mac
  857. XXinverse of
  858. XX.B mac2ibm:
  859. XXconversion table from a small subset of
  860. XXIBM CP 850 to Macintosh character set.
  861. XX.TP
  862. XX.B ebc2ns7
  863. XXconversion table from the IBM EBCDIC character set to the Norwegian
  864. XXversion of the ASCII 7-bit character set (ISO646 NS4551).
  865. XX.TP
  866. XX.B ibm2ro8
  867. XXconversion table from the IBM-PC 8-bit character
  868. XXset to Hewlett-Packard ROMAN8.
  869. XX.TP
  870. XX.B ro82ibm
  871. XXinverse of
  872. XX.B ibm2ro8:
  873. XXconversion table from ROMAN8
  874. XXto IBM-PC character set.
  875. XX.TP
  876. XX.B ibm2iso
  877. XXconversion table from the IBM-PC CP 850 8-bit character
  878. XXset to ISO 8859/1.
  879. XX.TP
  880. XX.B iso2ibm
  881. XXinverse of
  882. XX.B ibm2iso:
  883. XXconversion table from ISO 8859/1 to CP 850.
  884. XX.SH AUTHOR
  885. XX.PP
  886. XXCopyright \(co 1989 Gisle Hannemyr.
  887. XX.PP
  888. XX.B Pep
  889. XXmay be freely distributed and copied, as long as this file
  890. XXis included in the distribution and that these statements
  891. XXabout authorship and copyright is not altered or removed.
  892. XX.PP
  893. XXBug reports, improvements, comments, suggestions and flames to:
  894. XX.ti +0.2i
  895. XXSnail: Gisle Hannemyr, Brageveien 3A, 0452 Oslo, Norway.
  896. XX.ti +0.2i
  897. XXEmail: gisle@nr.uninett (EAN);
  898. XX.ti +0.9i
  899. XXgisle@ifi.uio.no (Internet);
  900. XX.ti +0.9i
  901. XX\|.\|.\|.\|!mcvax!ifi!gisle (UUCP);
  902. XX.ti +0.9i
  903. XX(and several BBS mailboxes).
  904. XX.SH ACKNOWLEDGMENTS
  905. XX.PP
  906. XXThanks to Robert Andersson, for the SYS-V
  907. XX.I "rename"
  908. XXfunction; and to
  909. XXKnut Borge, Bjoern Larsen, Knut Omang and Geir-Harald Strand,
  910. XXfor elucidation of the unspeakeable mysteries of VMS.
  911. XXSpecial thanks are due Inge Arnesen for finding and fixed a bug,
  912. XX(and to Nils-Eivind Naas for bringing it to my attention).
  913. XX
  914. XXSeveral people have contributed ideas and/or bug reports.
  915. XXIn addition to those mentioned above,
  916. XXOla Garstad, Ottar Grimstad,
  917. XXTor Sjoewall, and Jens-Henrik Soerensen
  918. XXshould be mentioned.  My apologies if anyone
  919. XXis forgotten.
  920. XX.SH SEE ALSO
  921. XX.LP
  922. XX.BR dd (1),
  923. XX.BR detex (1L),
  924. XX.BR convert (VMS),
  925. XX.BR expand (1),
  926. XX.BR od (1V),
  927. XX.BR strings (1),
  928. XX.BR tr (1),
  929. XX.BR unexpand (1).
  930. XX.PP
  931. XX.BR Detex (1L)
  932. XXis a lex-based program to convert LaTex and TeX manuscripts into plain
  933. XXASCII text.  It is available from the author upon request.  Those marked
  934. XXVMS are standard VMS utilities.  The others are standard UNIX utilities.
  935. XX.SH BUGS
  936. XX.PP
  937. XXThere is a very strong Norwegian bias in
  938. XX.B pep.
  939. XXIn particular,
  940. XXthere exists several national versions of the ISO 646 7-bit
  941. XXcharacter set; but all built-in functions to convert between this
  942. XXand various 8-bit character sets (i.e.
  943. XX.B \-d, \-i, \-k
  944. XXand
  945. XX.BR \-m )
  946. XXbluntly assumes the standard Norwegian version of the ISO 646. For
  947. XX.B pep
  948. XXto work with other national 7-bit character sets, the
  949. XXcompiled in conversion tables (type FOLDMATRIX for those who read the
  950. XXsource code) need to be extended.
  951. XX.PP
  952. XXThe VMS version of
  953. XX.B pep
  954. XXruns with the
  955. XX.B \-o
  956. XXoption permanently enabled.  This is because VMS does not support an
  957. XXuseful i/o redirection or pipe mechanism.
  958. XX.PP
  959. XXThe VMS Record Management Service (RMS) knows of several record formats.
  960. XXYou can see what record format a file is by using the VMS DCL command
  961. XX.I "DIRECTORY/FULL"
  962. XXand examine the field "Record format".
  963. XXOn VMS systems,
  964. XX.B Pep
  965. XXwill always generate output files with record format set to "Stream_LF",
  966. XXbut some programs may require that the output file is in other
  967. XXformats.  To fix this, it might be necessary to run the output of
  968. XX.B pep
  969. XXthrough the VMS
  970. XX.B CONVERT
  971. XXutility.  Please see the DEC VMS manuals for details.
  972. XX.PP
  973. XXThe Macintosh "text only" format uses the carriage return (CR) character
  974. XX(ASCII 13) as terminator.  Most text processors (e.g. MacWrite)
  975. XXseems capable of handling two conventions:
  976. XXOne is to use CR to terminate each line (and two or more
  977. XXconsequtive CR's between paragraphs); the other is to use CR between
  978. XXparagraphs only.
  979. XX.B Pep
  980. XXis also capable of handling both conventions.  The default behaviour
  981. XXis to terminate each line, but the
  982. XX.B \-v
  983. XXoption may be used to terminate paragraphs only.
  984. XXPlease note that
  985. XX.B pep
  986. XXuses a rather simplistic heuristic to identify the end of a paragraph,
  987. XXit bluntly assumes that paragraphs are separated by blank lines.
  988. XX.PP
  989. XXIf you use the
  990. XX.B \-o
  991. XXoption, then the original input file will
  992. XXbe overwritten.  Before you are familiar with
  993. XX.B pep,
  994. XXyou may
  995. XXfind that it sometimes removes more material than you expect
  996. XXfrom a file.  It may be a good idea to always make a copy
  997. XXof the original file before you start experimenting with
  998. XX.B pep,
  999. XXor you may add the
  1000. XX.B
  1001. XX"b"
  1002. XXargument to the
  1003. XX.B
  1004. XX\-o
  1005. XXoption
  1006. XX.B
  1007. XX(\-ob).
  1008. XX.PP
  1009. XXThe built-in IBM-PC, DEC and Macintosh conversion tables
  1010. XXconverts to and from the Norwegian version of 7-bit "ASCII"
  1011. XXcharacters.  You should use the
  1012. XX.B \-g
  1013. XXoption and "general" conversion tables for all other purposes.
  1014. XX.PP
  1015. XX.B Pep
  1016. XXonly knows the ANSI sequences implemented in the
  1017. XXstandard MS-DOS console driver
  1018. XX.I
  1019. XXANSI.SYS.
  1020. XX.PP
  1021. XXThere cannot be a space character between an option and the
  1022. XXoption's argument (e.g. you'll have to use
  1023. XX.B
  1024. XX"\-gfoo.bar",
  1025. XXnot
  1026. XX.B
  1027. XX"\-g foo.bar").
  1028. XX.PP
  1029. XXPep will only filter "regular" files.  It will skip directories, sockets
  1030. XXand "special" files.
  1031. XX.PP
  1032. XXLinks are the GOTOs of file systems.  If you run a hard linked file
  1033. XXthrough pep using the
  1034. XX.B \-o
  1035. XXoption, the link will not be preserved.  Pep will just skip soft
  1036. XXlinked files.
  1037. XX.PP
  1038. XX.B Pep
  1039. XXsearches for the conversion tables requested with the
  1040. XX.B
  1041. XX\-g
  1042. XXoption in the following order: first the current directory,
  1043. XXthen the directory of the file
  1044. XX.I PEP.EXE
  1045. XX(MS-DOS only), and finally the directory pointed to by the
  1046. XX.B PEP
  1047. XXenvironment
  1048. XXvariable.
  1049. XX.PP
  1050. XX.B Pep
  1051. XXknows nothing about the COFF-format and the
  1052. XX.B \-s
  1053. XXoption is
  1054. XXprimitive compared to the UNIX command
  1055. XX.IR strings (1).
  1056. XXSo if you are on a UNIX-system \(em forget about the
  1057. XX.B \-s
  1058. XXoption and use
  1059. XX.IR strings (1)
  1060. XXinstead.
  1061. XX.PP
  1062. XX.B Pep
  1063. XXwill not convert Word Perfect documents into plain ASCII.
  1064. XXThis much requested function is, however, built into Word Perfect.
  1065. XXIt is named "store as DOS-text" and is activated by pressing
  1066. XXCTRL-F5 (at least in Word Perfect 4.2).
  1067. XX.\" EOF
  1068. SHAR_EOF
  1069. if test 28373 -ne "`wc -c pep.1l`"
  1070. then
  1071. echo shar: error transmitting pep.1l '(should have been 28373 characters)'
  1072. fi
  1073. #    End of shell archive
  1074. exit 0
  1075.  
  1076.