NAME:
  repwrite
 PURPOSE:
  Update file by replacing or adding line of information
 DESCRIPTION:
 CATEGORY:
  Utility
 CALLING SEQUENCE:
  repwrite,file,tag,line
 INPUTS:

  file - string of file name to update (or create)

  tag  - key to scan at the start of the line, all lines found
          matching this key will be replaced by the new line provided.
          Any other line matching this tag will be removed from the file.
          (scalar or vector, length must match LINE)

  line - Replacement line for file.  If tag is not found, this will be
          added to the file.  The output is left sorted by the tags.
          If this is an empty string (''), then all lines that match the
          tag will be removed.
          (scalar or vector, length must match TAG)

 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:

  HEADER  - String array to put at start of file if file is created.
              Default is no header.  If file already exists, then this is
              ignored.

  HEADLEN - Number of lines at the start of the file to pass over.
              File must have at least this many lines to be valid.  If no
              header provided, the default is 0.  If you give a header, then
              the length of the string array is used as the default header
              length.
           
 OUTPUTS:
  All output is to the file.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  96/11/19, Written by Marc W. Buie, Lowell Observatory
  97/2/6, MWB, different algorithm and file is now sorted.
  97/10/09, MWB, added HEADER and HEADLEN keywords
  98/03/22, MWB, added NOSORT keyword
  2000/09/20, MWB, added support for vector input on tag and line