📄 foo
字号:
<HTML><BODY><PRE></PRE><H2>NAME</H2><PRE> select - applies arbitrary queries to select records from FEA files eselect - applies arbitrary queries to select records from FEA files</PRE><H2>SYNOPSIS</H2><PRE> <STRONG>select</STRONG> [ <STRONG>-n</STRONG> ] [ <STRONG>-c</STRONG> ] [ <STRONG>-q</STRONG> <EM>query</EM> ] [ <STRONG>-e</STRONG> <EM>expression</EM> ] [ <STRONG>-</STRONG> <STRONG>f</STRONG> <EM>format</EM> <EM>string</EM> ] [ <STRONG>-l</STRONG> <EM>log</EM> ] [ <STRONG>-o</STRONG> <EM>output</EM> ] [ <EM>input1</EM> <EM>input2</EM> ... ]</PRE><H2>DESCRIPTION</H2><PRE> This program is stored under the name <EM>select</EM> and <EM>eselect</EM> in order to avoid a name conflict with the <EM>ksh</EM> builtin command <EM>select</EM>. <EM>Select</EM> applies selection criteria to FEA files. The selected records may be printed and may appended to an internal record buffer, which in turn may be output to another FEA file. The selection criteria are specified as a set of queries, with each query being a condition on the fields in the FEA record. <EM>Select</EM> operates in two modes: non-interactive and interac- tive. The non-interactive mode applies when the <STRONG>-q</STRONG> and <STRONG>-o</STRONG> options are used. In this case, the specified query is applied to all of the <EM>input</EM> files and the selected records are written to <EM>output</EM>. In interactive mode (no <STRONG>-q</STRONG> option), <EM>select</EM> prompts the user for commands (see below). Alternatively, a file of selec- tion commands can be used as standard input (e.g., <EM>select</EM> < <EM>command</EM>_<EM>file</EM>). Command files can also be invoked interac- tively. The following options are interpreted by <EM>select</EM>: <STRONG>-n</STRONG> No source files or comments about queries are added to the headers of output files. Normally, the headers of output files are expanded to include the the input files as sources and the selection queries as comments in the <EM>variable</EM>.<EM>comment</EM> field. The <STRONG>-n</STRONG> option disables this and results in faster operation, especially when the output file already exists and is large. <STRONG>-c</STRONG> By default, comparisons involving feature fields of type coded are case insensitive. When the <STRONG>-c</STRONG> option is used, these comparisons are case sensitive. <STRONG>-q</STRONG> <EM>query</EM> Apply the <EM>query</EM> to the <EM>input</EM> files and write the selected records to <EM>output</EM> (see <STRONG>-o</STRONG>). <STRONG>-e</STRONG> <EM>expression</EM> Execute the <EM>eval</EM> command on the input file and print the result to standard output. For details, see the <EM>eval</EM> command below. <STRONG>-f</STRONG> <EM>printf</EM> <EM>format</EM> <EM>string</EM> This option allows the specification of a <EM>printf</EM> format string to be used to output the values resulting from use of the <STRONG>-e</STRONG> option. The string can be any valid <EM>printf</EM> format string, except that only the following character escapes are handled: \n, \t, \b, \r, \f, \\ (to enter a slash), and \' (to enter a single quote). (Note in particular, that \ddd is not handled.) Keep in mind that the value being displayed is typed <EM>double</EM> inside of the program. So use of an incompatible out- put specification will result in garbage dispplay. For example the following option might be used: <STRONG>-f</STRONG> <STRONG>'Value:\t%e\n'</STRONG> or <STRONG>-f</STRONG> <STRONG>Any</STRONG> <STRONG>string:</STRONG> <STRONG>%f</STRONG> <STRONG>units\n'</STRONG>. The specification string should contain at most one output format control appropriate for double values (%e, %f, %g). <STRONG>-o</STRONG> <EM>output</EM> Specifies an output file. This option must be used if the <STRONG>-q</STRONG> option is used, and it cannot be used unless one or more input files are specified on the command line. <STRONG>-l</STRONG> <EM>log</EM> All user commands, together with all terminal output from <EM>select</EM>, will be recorded on a file named <EM>log</EM>. Each command to <EM>select</EM> consists of one or two keywords fol- lowed by arguments. The keywords may be abbreviated. Your unix interrupt character (<EM>e</EM>.<EM>g</EM>. ^C) will always terminate the current command. Required portions of the keywords are shown in capital letters in the description below; <EM>select</EM> is not sensitive to case. An EOF is equivalent to a <STRONG>Write</STRONG> fol- lowed by a <STRONG>Quit.</STRONG> Tagged and segment labelled input files involve some special handling in order to make it possible to associate output records with the sampled data files to which the input records refer. If the output file does not exist, and if there is only one tagged input file, then the output file is also tagged, with the tags being pointers into the same refer file as specified in the input file. If the output file does not exist, and if there are two or more tagged input files, the output file is segment labelled, and all tagged records written to the output file are converted to segment labelled. For the case of an existing output file, see the note under BUGS below. For more information about taggged and segment labelled FEA files, see <STRONG><A HREF="../man5.html/FEA.5.html">FEA (5-ESPS)</A></STRONG>. <STRONG>@</STRONG><EM>comfile</EM> This command causes <EM>select</EM> to read commands from the file <EM>comfile</EM> , rather than from the standard input. When end-of-file is reached, <EM>select</EM> resumes reading from the standard input. Command files may be nested; the maximum nesting depth is three. Command files are aborted (all remaining commands are skipped) if an error or user interrupt occurs while the command file is being read. <STRONG>!</STRONG><EM>command</EM> Shell escape. A shell is forked off to execute <EM>com-</EM> <EM>mand</EM>. The command output does not appear in the log file. The exclamation point must be in the first column. A "#" character is not considered a comment in <EM>command</EM>, since the command may require that character. <STRONG>CLEar</STRONG> If the record buffer has been changed since the last write, a warning is printed and the user is asked to confirm. If the user answers the confirmation request with "yes", the the record buffer is cleared. <STRONG>CLOse</STRONG> Closes the log file, if any. <STRONG>EVal</STRONG> <EM>QUERY</EM> Prints the value of the <EM>QUERY</EM> expression (see SYNTAX DETAILS) for each record in the input set. The record number relative to the input file and relative to the set of input files (if there is more than one input file) is also printed. <STRONG>From</STRONG> <EM>input1</EM>, <EM>input2</EM>, ... Closes an existing input files, if any are open, and opens the new ones. All input files must be FEA files. Note that an initial set of input files can be speci- fied on the command line. <STRONG>HEAder</STRONG> <EM>flags</EM> Prints the headers of the current set of input files, using <STRONG><A HREF="../man1.html/psps.1.html">psps(1-ESPS)</A></STRONG> with the <STRONG>-x</STRONG> flag. The <EM>psps</EM> flags <STRONG>-</STRONG> <STRONG>frhv</STRONG> may also be specified. The outputs are run through the <EM>more</EM> program (unless PAGER is set to a dif- ferent program name; see ENVIRONMENT). The output is not written to the log file. <STRONG>HELp</STRONG> Prints a summary of the commands accepted by <EM>select</EM>. The help file is run through the <EM>more</EM> program (unless PAGER is set to a different program name; see ENVIRON- MENT). <STRONG>Log</STRONG> <EM>logfile</EM> Specifies that the dialog with the user will be saved on <EM>logfile</EM> (equivalent to the <STRONG>-l</STRONG> command line option). If a log file is already open, the old log file is closed and a new file is started. If the argument is omitted, the command is equivalent to Show Log. <STRONG>Select</STRONG> <EM>QUERY</EM> Processes the input files one at a time, selects all records that satisfy the <EM>QUERY</EM>, and appends them to the record buffer. During queries that scan more than 1000 records, a dot will be printed for each 1000 records scanned. The number of records selected from each file and the total number selected are printed when the select is complete or interrupted. <STRONG>SHow</STRONG> <STRONG>Buffer</STRONG> Prints the records in the record buffer. The output is run through the <EM>more</EM> program (unless PAGER is set to a different program name; see ENVIRONMENT). <STRONG>SHow</STRONG> <STRONG>FIelds</STRONG> Prints the field definitions of <EM>input</EM>. <STRONG>SHow</STRONG> <STRONG>FRom</STRONG> <EM>flags</EM> Runs <EM>psps</EM> on the current set of input files. Any of the <EM>psps</EM> flags may be specified. The output is run through the <EM>more</EM> program (unless PAGER is set to a dif- ferent program name; see ENVIRONMENT). <STRONG>SHow</STRONG> <STRONG>LOg</STRONG> This command tells whether a log file is open, and gives its name if there is an open file. <STRONG>SHow</STRONG> <STRONG>LAst</STRONG> Prints the last record in the select buffer. <STRONG>SHow</STRONG> <STRONG>Select</STRONG> <EM>QUERY</EM> Processes the input files one at a time, selects all records that satisfy the <EM>QUERY</EM>, and prints them. The number of records selected from each file and the total number selected are printed. The output is run through the <EM>more</EM> program (unless PAGER is set to a different program name; see ENVIRONMENT). If this command is interrupted with one interrupt character, then printing of the records is suspended, but the selection contin- ues. The total records that match the <EM>QUERY</EM> will be printed as usual. If the command is interrupted for a second time the command will quit without checking additional records. <STRONG>SHow</STRONG> <STRONG>To</STRONG> <EM>flags</EM> Runs <EM>psps</EM> on <EM>output</EM>. Any of the <EM>psps</EM> flags may be specified. The output is run through the <EM>more</EM> program (unless PAGER is set to a different program name; see ENVIRONMENT). <STRONG>SIze</STRONG> Prints the number of records in the record buffer. <STRONG>To</STRONG> <EM>output</EM> [ <STRONG>With</STRONG> <EM>fieldname1</EM>, <EM>fieldname2</EM>, ...] <STRONG>To</STRONG> <EM>output</EM> [ <STRONG>Without</STRONG> <EM>fieldname1</EM>, <EM>fieldname2</EM>, ...] Specifies an output file. If an output file has already been specified, <EM>select</EM> closes it and opens the new one provided that the record buffer has not changed since the last write. If the record buffer has been changed since the last write, a warning is printed and no action is taken. If the TO command is then repeated as the next command, the existing output file is closed and the new one is opened. Note that an output file can be specified on the command line. An output file cannot be specified until an input file has been speci- fied. Furthermore, the output file, if it exists, must have a compatible header with that of the first input file (same field definitions). If the output file does not exist, the <STRONG>With</STRONG> clause can be used to specify which fields from input records will be written to the output file, or the <STRONG>Without</STRONG> clause can be used to specify which fields to omit. <STRONG>Quit</STRONG> If the record buffer has not changed since the last write, <EM>select</EM> exits. If the record buffer has been changed since the last write, a warning is printed and the user is asked to confirm the command. If the user responds to the confirmation request with "yes", then the program is terminated without writing the output file. <STRONG>Undo</STRONG> This command removes the records from the record buffer resulting from the last Select command. This command can only be given between a Select and a Write. Undo cannot be undone. <STRONG>Version</STRONG> Prints out the version number and the date of the last edit (actually, the date of the last modification of the SCCS database where <EM>select</EM> is maintained). <STRONG>Write</STRONG> If <EM>output</EM> does not exist (see the TO command), it is created and the contents of the record buffer are writ- ten to it. If <EM>output</EM> exists, the contents of the record buffer are appended. The record buffer is then cleared.</PRE><H2>SYNTAX DETAILS</H2><PRE> A <EM>QUERY</EM> consists of an expression, which has the following form: <expr> ::= <value> | <field_name>{[<index>]} | <character_string> | $<external_function> | <function> (<field_name>) | <function> (<expr>) | ( <expr> ) | <expr> <arith_op> <expr> | <expr> <rel_op> <expr> | - <expr> | <expr> Here, <field_name> is a FEA record field name, <index> is an integer value indicating an offset from the beginning of the field (used if the field is not a scaler), <value> is a numerical value, <character_string> is a character string in quotes ("), <function> is the name of a built in function (see FUNCTIONS), <rel_op> is a relational operator, and <arith_op> is a arithmetic operator (defined below). <external_function> is the name of an external program that is called to implement some function on each record. This is described in detail below. The "{}" brackets indicate that the inclusion of field index is optional. If <field_name> is not a scaler field, <field_name> is equivalent to <field_name>[0] when used in an expression. An <external_function> is always preceded by a dollar sign ($). If a <field_name> is used in an expression which is not defined in the current input file, then a warning is printed
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -