next up previous contents index
Next: 3.3 History of Data Up: 3. File structure Previous: 3.1 Binary Structured Files   Contents   Index

3.2 Pipes

In the UNIX operating system pipes can be very effectively used to pass information from one process to another. One of the well known textbook examples is how one gets a list of misspelled (or unknown) words from a document:

    % spell file | sort | uniq | more

NEMO programs can also pass data via UNIX pipes, although with a slightly different syntax: a dataset that is going to be part of a pipe (either input or output) has to be designated with the - (``dash'') symbol for their filename. Also, and this is very important, the receiving task at the other end of the pipe should get data from only one source of course. If the task at the sending end of the pipe wants to send binary data over that pipe, but in addition the same task would also write ``normal'' standard output, the pipe would be corrupted with two incompatible sources of data. An example of this is the program snapcenter. The keyword report must be set to false instead, which is actually the default now. So, for example, the output of a previous N-body integration is re-centered on it's center of mass, and subsequently rectified and stacked into a single image as follows:

    % snapcenter r001.dat . report=t  | tabplot - 0 1,2,3
    
    % snapcenter r001.dat - report=f       |\
        snaprect - - 'weight=-phi*phi*phi' |\
        snapgrid - r001.sum stack=t

If the keyword report=f would not have been set properly, snaprect would not have been able to process it's convoluted input. Some other examples are discussed in Section [*].


next up previous contents index
Next: 3.3 History of Data Up: 3. File structure Previous: 3.1 Binary Structured Files   Contents   Index
(c) Peter Teuben