.help hfix Nov91 proto
.ih
NAME
hfix -- fix image headers with a user specified command
.ih
USAGE
hfix images
.ih
PARAMETERS
.ls images
List of images whose headers are to be fixed.  If \fIupdate\fR is yes then
the user must have write permission on the image headers.
.le
.ls command = "edit $fname"
Command to be applied to a file containing the image header.  The command
may be any CL command which includes escapes to host commands.  The file
containing the header in text form is specified by the special string
"$fname".  The command should modify this file to the desired form.  The
default is to invoke a text editor but there are many other possibilities.
The image name may also be specified with "$image".  See the EXAMPLES
section for some ideas.
.le
.ls update = yes
Update the image header with the modified header.
.le
.ih
DESCRIPTION
This task allows you to extract the image headers into a text file,
modify this file with a specified command, and update the image header
with the modified file.  The command to be applied is specified with
the \fIcommand\fR parameter.  In this command the text file containing
the header to be acted upon is referenced with the string "$fname".
If it is desired to update the image header with the modified file
the \fIupdate\fR switch must be set.  You must have write permission
to update the image headers.

A common command, which is the default, is to use a text editor.
Other possibilities are to save the file, use a non-interactive host
command such as \fBsed\fR in UNIX, or write your own program or
script.

This task does very little processing on the header after you are finished
editing.  It checks for legal FITS characters in the first 8 columns and if
there is an '=' in column 9 then there must be a ' ' (blank) in column 10.
Lines violating these checks are skipped.  It also sets each line in the
header to the correct length.  Because you have total freedom to change the
header parameters while in the text editor, you must make sure that the
header has a legal format after you are through editing it. In particular,
be sure each field in the header parameters that you add or change begin in
the proper columns.
.ih
EXAMPLES
1. Edit the header of the image test.imh:

.nf
	cl> hfix test.imh
	<Edit the header text>
.fi

2. Get the header of a single image and save the file:

.nf
	cl> hfix myim command="copy $fname save" update-
.fi

3. A image header was created with an incorrect format such that the
equal sign is in column 10 instead of 9:

.nf
	cl> hfix *.imh \
	>>> command="!sed 's/ =/=/' $fname >temp;mv temp $fname"
.fi

Note that this example should not be tried on a valid header where the
equal sign is in column 9.
.ih
SEE ALSO
images.hedit noao.artdata.mkheader
.endhelp
