MED(1NCARG) | NCAR GRAPHICS | MED(1NCARG) |
med - NCAR CGM metafile frame editor
med [ -e command ]* [ -f sfilename ] [ -l local_dir ] [ -V ] [ filename]
med is a frame-level, metafile editor designed to resemble syntactically UNIX's sed(1) and ed(1). med operates on a copy of filename, called a buffer, and overwrites a file only when you issue the w (write) command. med provides line oriented editing commands to display or delete frames from the buffer, to move, copy or merge frames within the buffer, or to write frames from and read frames into the buffer. By default med reads in commands from standard input.
med commands attempt to have a syntactically identical form to those of ed(1) or sed(1). Commands consist of an optional address or two optional, comma separated, addresses, followed by a command, which may be abbreviated, possibly followed by a third address or a command specific argument list :
For example, 1,10p means “print (display) frame 1 through 10” (two addresses), d means “delete the current frame” (no address implies the current frame used as default), and 1,5c5 means “append a copy of frames 1 through 5 at frame 5” (three addresses). The meaning of argument varies for each operation. In med's current state the only valid argument is a filename — for the write, w , command for instance, argument is the name of the file to write to.
Unlike its friends ed(1) and sed(1) med attempts to be fairly user friendly. If an invalid or ambiguous command is given med will tell you so. If med thinks it recognizes a command with invalid arguments a usage statement for the offending command is given. If a particular command fails and med is smart enough to figure out why it will tell you. med will almost ALWAYS immediately terminate when an error occurs while processing commands from a file or the command line. Help is available by using the h command. Usage statements for a particular command may be obtained with: h command name .
Frames can be addressed in several ways:
If you do not specify an address for a command to operate on, a command that requires an address supplies one by default, usually the current frame.
A pair of addresses separated by a comma signifies an inclusive range of frames, and the current frame is not changed unless the command changes it.
Only one command may appear per line. Commands may accept zero, one or two addresses, followed by possibly a third address or an argument. Commands that accept up to two addresses regard a third as an error. Likewise, commands that do not accept an argument regard one as an error. Commands may be abbreviated.
In the absence of a second address for a two or three address command the command will regard the second address as the same as the first. For example, 2d is equivalent to 2,2d . The absence of a first address, where required, will result in the current frame being used as the default. The same is true in the absence of a required third address. For example, c is equivalent to .,.c..
The commands q (quit) and e (edit) may be followed by a '!' to override med's user protection.
In the following list of med commands, the default addresses/arguments appear in parentheses; the parenthesized addresses are not part of the command. Unless otherwise noted a command does not change the current frame number.
(1,$)append metafile
Append buffer to a file. Append the addressed frames in the buffer to
metafile. If no address is specified the entire buffer is written. If
the file does not exist create it.
(.,.)label string
Label the addressed frames with string . The CGM Begin
Picture element contained in each metafile frame allows for the encoding
of character data. label provides a means for accessing this
data.
quit
Quit. Terminate the editing session without saving the buffer contents. In
order to save the buffer an explicit write must be performed. If changes to
the buffer have been made since the last write med will refuse to
terminate unless quit is appended with a '!'.
(.)read metafile
Read in a metafile. Read the contents of metafile into the buffer and
append it at the given address. metafile must be a valid NCAR CGM.
The resulting current frame is the last frame read in.
(1,$)split<number> outfile
Split the current metafile into number files. The split command
attempts to create number metafiles from the addressed frames, each
containing approximately n / number frames where 'n' is the total number of
addressed frames. The first file is named outfile001.ncgm, the second
file is named outfile002.ncgm, and so on lexicographically. If no
outfile is given, med is used as the default (output files
will be called med001.ncgm, med002.ncgm, etc.).
(1,$)write metafile
Write buffer. Write the addressed frames in the buffer to metafile. If
no address is specified the entire buffer is written. If the file does not
exist create it. If no file name is specified med uses the last
currently remembered file name, if any. The currently remembered file name
is the file name from the most recent edit command, or the file name
med was invoked with if no edit commands have been issued.
To concatenate the files ncgm1, ncgm2, and ncgm3 into a single file ncgm123 one might use the following:
Or one could pass the following script to med as a -fscriptfile option or enter the commands interactively.
To Overlay the contents of frame 5 on top of frame 4 from a file ncgm1 one could execute:
% med -e '4,5 me' -e 'w!' ncgm1
Hardcopy: NCAR Graphics Fundamentals, UNIX Version
med
does not understand filenames that begin with a digit or a period.
The append, read and merge commands may produce surprising results. A CGM may contain a set of global graphical primitive attributes that are applied to every frame in a file. Thus reading frames in from a file with different global attributes than the current working file may not produce the desired effect. The same is true when appending frames to a previously existing file. Similarly, the CGM standard specifies that graphical attributes specified within a metafile frame affect all succeeding primitives. Thus a frame which is the product of the merge command may appear differently than expected.
Copyright (C) 1987-2009
University Corporation for Atmospheric Research
The use of this Software is governed by a License Agreement.
January 1993 | NCARG |