other versions
- jessie 6.2.0-3+b1
- jessie-backports 6.3.0-4~bpo8+1
- stretch 6.3.0-13
- testing 6.5.0-1
- unstable 6.5.0-2
MED(1NCARG) | NCAR GRAPHICS | MED(1NCARG) |
NAME¶
med - NCAR CGM metafile frame editorSYNOPSIS¶
med [ -e command ]* [ -f sfilename ] [ -l local_dir ] [ -V ] [ filename]DESCRIPTION¶
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.OPTIONS¶
- -e command
- command is a single med command. The valid med commands are discussed in the Commands section below. Multiple -e options may appear on a single command line. Be careful to use quotes if your command contains spaces or metacharacters that might be interpreted by the shell. When this option is used med does not enter interactive mode. It simply performs the given commands and then exits.
- -f sfilename
- Execute the med line-separated list of commands in the file sfilename. After the commands are exhausted med will exit.
- -l local_dir
- Use local_dir as the tmp directory for scratch disk space. If this option is not specified med will use the value of the $NCARG_TMP or the $TMPDIR environment variable. See ncargintro(1ncarg) for a discussion on NCAR Graphics environment variables.
- -V
- Print the version number and then exit.
USAGE¶
Command Structure¶
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 :- [ address [, address ] ] command [ address | args ]
Addresses¶
Frames can be addressed in several ways:- nnn
- By frame number. Frames in the buffer are numbered relative to the start of the buffer. The first frame is frame 1.
- $
- The last frame of the buffer.
- .
- The current frame. med keeps track of the frame on which you last performed an operation. This frame is called the current frame. You can address this frame by typing a “dot” character.
- ±n
- By relative frame number. Address the frame number that is n frames higher, or n frames lower than the current frame.
- address±n
- An address followed by a plus sign (+) or a minus sign (-), followed by a decimal number, specifies that address plus or minus the indicated number of frames. If the address is omitted, the current frame is used as the base. For example, `31-3' addresses frame 28 in the buffer.
Commands¶
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.
- (.,.) copy (.)
-
- (.,.)delete
- Delete the addressed lines from the buffer. delete accepts one or two addresses; the default is the current frame. The current frame is set to the first frame after the deleted frame(s).
- edit metafile
- Edit a metafile. The current contents of the buffer, if any, are erased. The named metafile is read in to the buffer. The resulting current frame is the last frame in the buffer. If changes have been made to the buffer since the last write med will refuse the request unless the command is appended with a '!'. edit prints the number of frames in the metafile. If no metafile is given, the current metafile, if any is used. The current frame becomes the last frame in the file.
- help command
- help. Give a usage message for command . If no command is given, print list of command names with a short description of each.
(.,.)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.
- (.,.)merge
- Merge the contents of the second addressed frame on top of the first addressed frame. The first addressed frame is thus changed. The second frame remains the same. The current frame is set to the first addressed frame.
- (.,.) move (.)
-
- Show the contents of the buffer at the given address. What is actually displayed is information regarding the addressed frames. This information includes: relative frame number within the buffer, the number of records contained in the frame, the starting record for the frame and the contents of the CGM element BEGIN PICTURE . If no address is specified the current frame does not change. Otherwise it becomes the last frame printed.
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.
- ! command
-
ENVIRONMENT¶
- NCARG_TMP
- If set, this environment variable contains a directory path to be used for temporary files. On most systems the default is /tmp.
FILES¶
- /tmp/cgm_tools.#
- temporary; # is the process id.
EXAMPLES¶
To concatenate the files ncgm1, ncgm2, and ncgm3 into a single file ncgm123 one might use the following:- % med -e 'r ncgm1' -e 'r ncgm2' -e 'r ncgm3' -e 'w ncgm123'
- % med -e '4,5 me' -e 'w!' ncgm1
SEE ALSO¶
cgm(5NCARG), ed(1), sed(1V) Hardcopy: NCAR Graphics Fundamentals, UNIX VersionBUGS¶
meddoes not understand filenames that begin with a digit or a period.
CAVEATS¶
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¶
Copyright (C) 1987-2009January 1993 | NCARG |