home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / CONVCHAR.ZIP / CONVCHAR.DOC < prev    next >
Text File  |  1989-06-12  |  3KB  |  57 lines

  1. ConvChar is a DOS filter that reads and copies its input from stdin to
  2. stdout, converting a selected character to another in the copy operation.
  3. It requires two arguments, the decimal values of the characters to convert.
  4. As with all DOS filters, you must supply at least the input file or source
  5. to read the characters, or it will read from stdin, the keyboard.
  6.  
  7. Running ConvChar without its two required parameters gives a help message:
  8.  
  9. ConvChar is a DOS filter to convert single character values globally
  10.   to another character value.  Usage:
  11.  
  12. ConvChar fromchar tochar <source >dest       Where:
  13.  
  14.   fromchar is the decimal value of the character to convert
  15.   tochar   is the decimal value of the character to replace
  16.   source   is the Ascii source file
  17.   dest     is the Ascii destination file
  18.  
  19. ConvChar 0 255 <olddoc >newdoc
  20. Reads & copies OLDDOC file to NEWDOC, converting chars valued 0 to value 255
  21.  
  22. ConvChar 255 0 <newdoc >newerdoc
  23. Reverses above, reads NEWDOC, converts 255 value chars back to 0 on NEWERDOC
  24.  
  25. DIR /W | ConvChar 9 32
  26. Converts all tab chars from DIR /W (value 9) to a single space (value 32)
  27.  
  28.  
  29. ConvChar was written by Steve Kraus as a utility in response to a question:
  30. How do you run DIFF on a file with embedded [NUL] characters?  The answer
  31. is to run the source document(s) through some kind of preprocessor to
  32. convert all those NUL characters to some other character value.  If you
  33. have some kind of formatted document created by a word processor that
  34. leaves NUL value formatting codes embedded in the output, DIFF will treat
  35. those embedded NUL (0 value) characters as end of strings.
  36.  
  37. This isn't exactly an elegant solution, but it works.  If you wish to
  38. convert two files with embedded NULS:  MyDoc1.PRN and MyDoc2.PRN, first
  39. convert both files to temporary files for comparison.  Use ConvChar to
  40. change the NUL chars to 255, which usually displays and prints as a space.
  41. (I use 255, but experiment with your own character value).  Run the
  42. resulting files through DIFF, then convert the change bar file generated,
  43. changing 255 valued characters back to 0 for printing.  It will probably be
  44. necessary to fix the change bar locations in the resulting file, because
  45. DIFF treats 255 valued characters as if they occupy a space.
  46.  
  47. ConvChar 0 255 <MyDoc1.PRN >MyDoc1      <-- convert & copy MyDoc1 & 2
  48. ConvChar 0 255 <MyDoc2.PRN >MyDoc2
  49. DIFF -b 78 MyDoc1 MyDoc2 BarDoc         <-- compare & make a change
  50.                                              bar file
  51. ConvChar 255 0 <BarDoc >BarDoc.PRN      <-- convert embedded 255 chars
  52.                                              back to NUL (0) for printing
  53. ZDEL MyDoc1 MyDoc2 BarDoc               <-- delete scratch files
  54.  
  55. This utility is hereby released into public domain.  Have fun,
  56. Steve Kraus - 12 June 1989.
  57.