|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T c
Length: 2652 (0xa5c) Types: TextFile Names: »cut.1«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki └─⟦this⟧ »EUUGD11/euug-87hel/sec1/cut/cut.1«
.if t .ds ' \h@.05m@\s+4\v@.333m@\'\v@-.333m@\s-4\h@.05m@ .if n .ds ' ' .if t .ds ` \h@.05m@\s+4\v@.333m@\`\v@-.333m@\s-4\h@.05m@ .if n .ds ` ` .TH CUT 1 .SH NAME cut \- cut out selected fields of each line of a file .SH SYNOPSIS \fBcut \-c\fP\^list [\|file1 file2 ...] .br \fBcut \-f\fP\^list [\fB\-d\fP\|char\|] [\fB\-s\fP] [\|file1 file2 ...] .SH DESCRIPTION Use .I cut\^ to cut out columns from a table or fields from each line of a file; in data base parlance, it implements the projection of a relation. The fields as specified by .I list\^ can be fixed length, i.e., character positions as on a punched card (\fB\-c\fP option) or the length can vary from line to line and be marked with a field delimiter character like .I tab\^ (\fB\-f\fP option). .I Cut\^ can be used as a filter; if no files are given, the standard input is used. .PP The meanings of the options are: .br .TP "\w'\-d\ char\ \ 'u" .I list\^ A comma-separated list of integer field numbers, with optional \fB\-\fP to indicate ranges as in the .B \-o option of .IR nroff / troff for page ranges; e.g., .BR 1,4,7 ; .BR 1\-3,8 ; .B \-5,10 (short for \fB1\-5,10\fP); or .B 3\- (short for third through last field). .TP \fB\-c\fP\^\fIlist\fP The .I list\^ following .B \-c specifies character positions (e.g., .B \-c1\-72 would pass the first 72 characters of each line). .TP \fB\-f\fP\^\fIlist\fP The \fIlist\fP following .B \-f is a list of fields assumed to be separated in the file by a delimiter character (see .B \-d ); e.g., .B \-f1,7 copies the first and seventh field only. Lines with no field delimiters will be passed through intact (useful for table subheadings), unless .B \-s is specified. .TP \fB\-d\fP\^\fIchar\fP The character following .B \-d is the field delimiter (\c .B \-f option only). Default is .IR tab . Space or other characters with special meaning to the shell must be quoted. .TP .B \-s Suppresses lines with no delimiter characters in case of .B \-f option. Unless specified, lines with no delimiters will be passed through untouched. .PP Either the .B \-c or .B \-f option must be specified. .SH HINTS Use .IR grep (1) to make horizontal ``cuts'' (by context) through a file, or .IR paste (1) to put files together column-wise (i.e., horizontally). To reorder columns in a table, use .I cut\^ and .IR paste . .SH EXAMPLES .TP 2.25i cut \-d: \-f1,5 /etc/passwd mapping of user \s-1ID\s0s to names .TP name=\*`who am i | cut \-f1 \-d" "\*` to set .B name to current login name. .SH DIAGNOSTICS .PP Error messages may come from getopt(3). All error messages contain limits for line and field lenghts. .SH SEE ALSO grep(1), paste(1). getopt(3)