.TH WRSAMP 1 "11 August 1993" "MIT DB software 8.1" "DB applications" .SH NAME wrsamp \- write DB signal files .SH SYNOPSIS \fBwrsamp \fR[ \fIoptions\fR ... ] \fIcolumn\fR [ \fIcolumn\fR ... ] .SH DESCRIPTION \fIwrsamp\fR reads text-format input and writes the specified \fIcolumns\fR in DB signal file format 16 (see \fIsignal\fR(5)), either to the standard output or to a disk file (see the \fB-o\fR option below). .PP Normally, \fIwrsamp\fR's input is line- and column-oriented, with \fIline separator characters\fR (usually ASCII linefeeds) separating input lines, and \fIfield separator characters\fR (usually spaces or tabs) separating columns within each line. Columns need not be of constant width; the only requirement is that one or more field separator characters appear between adjacent columns. The output of \fIrdsamp\fR(1) is an example of an acceptable input format. .PP Lines are identified by line number. The first line of input is line 0. Similarly, columns are identified by column number, and the leftmost column is column 0. Columns may be selected in any order, and any given column may be selected more than once, or omitted. The order of \fIcolumn\fR arguments determines the order of the signals in the output (data from the first \fIcolumn\fR specified are written as signal 0, etc.) If an entry in a specified column is missing or improperly formatted, \fIwrsamp\fR produces a warning message identifying the line and column numbers, and inserts a zero in the output in place of the missing or improperly formatted sample. .PP \fIOptions\fR include: .TP \fB-c\fR Check that each input line contains the same number of fields. (This test is normally disabled, to allow for input files containing preambles, trailers, or occasional extra fields not intended to be read as samples.) .TP \fB-f\fI n\fR Start copying with line \fIn\fR. By default, \fIwrsamp\fR starts at the beginning of its standard input (line 0). .TP \fB-F\fI n\fR Specify the sampling frequency (in samples per second per signal) for the output signals (default: 250). This option is useful only in conjunction with \fB-o\fR, since it affects the output header file only. This option has no effect on the output signal file, which contains one sample per signal for each line of input. If you wish to change the sampling frequency in the signal file, see \fIxform\fR(1). .TP \fB-G\fI n\fR Specify the gain (in A/D units per millivolt) for the output signals (default: 200). This option is useful only in conjunction with \fB-o\fR, since it affects the output header file only. This option has no effect on the output signal file. If you wish to rescale samples in the signal file, use \fB-x\fR. .TP \fB-h\fR Print a usage summary. .TP \fB-i\fI file\fR Read input from the specified \fIfile\fR (default: standard input). .TP \fB-l\fI n\fR Read up to \fIn\fR characters in each line (default: 1024). Longer lines are truncated (with a warning message identifying the line number of the offending line). .TP \fB-o\fI record\fR Write the signal file in the current directory as \fIrecord\fB.dat\fR, and create a header file in the current directory for the specified \fIrecord\fR. By default, \fIwrsamp\fR writes the signal file to its standard output in format 16 (see \fIsignal\fR(5)), and does not create a header file. .TP \fB-r\fI c\fR Interpret \fIc\fR as the input line separator (default: \\n, the ASCII linefeed character). This option may be useful, for example, to read Macintosh files containing carriage-return delimited lines. Note that no special treatment is required for files containing both carriage returns and linefeeds. .TP \fB-s\fI c\fR Interpret \fIc\fR as the input field separator (default: both spaces and tabs are treated as input field separators). If this option is used, \fIc\fR is the \fIonly\fR character treated as a field separator. .TP \fB-t\fI n\fR Stop copying at line \fIn\fR (line \fIn\fR is not processed). By default, \fIwrsamp\fR stops when it reaches the end of file on its standard input. .TP \fB-x\fI n\fR Multiply all input samples by \fIn\fR (default: 1) before writing them to the output signal file. .PP The shell variable \fBDB\fR should be set and exported (see \fIsetdb\fR(1)). .SS Example .br \fBrdsamp -r 100s | wrsamp -o 100w -F 360 1 2\fR .br This command creates a record named `100w' that is a copy of record `100s' (although the signal file format is different). If the \fB-F 360\fR option were omitted, the output signal file (`100w.dat') would be unchanged, but the header file for record `100w' would indicate that the sampling frequency was (the default) 250 Hz, rather than 360 Hz as in record 100s; this is because \fIwrsamp\fR has no other way of determining the sampling frequency of its input. Note that columns 1 and 2 of \fIwrsamp\fR's input correspond to signals 0 and 1 respectively; column 0 is the sample number, not useful to \fIwrsamp\fR. .SH SEE ALSO rdsamp(1), setdb(1), xform(1), signal(5) .SH AVAILABILITY This program is included in version 8.1 and later versions of the DB Software Package.