CUT(1) COMMAND REFERENCE CUT(1) NAME cut - cut out selected fields of each line of a file SYNOPSIS cut -clist [ filename ... ] cut -flist [ -dchar ] [ -s ] [ filename ... ] DESCRIPTION Use 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 list can be fixed length (for example, character positions as on a punched card (-c option)), or the length can vary from line to line and be marked with a field delimiter character like tab (-f option). Cut can be used as a filter; if no files are given, the standard input is used. The output is printed on the standard output. Use grep (1) to make horizontal "cuts" (by context) through a file, or paste (1) to put files together column-wise (for example, horizontally). To reorder columns in a table, use cut and paste . OPTIONS list A comma separated list of field or column numbers that is used with the -c and -f options. The list is specified like the -o option of nroff/troff for page ranges; for example: 1,4,7; 1-3,8; -5,10 (short for 1-5,10); or 3- (short for third through last field). -clist The list following -c (no space) specifies character positions (for example, -c1-72 would pass the first 72 characters of each line). -dchar The character following -d is the field delimiter (-f option only). Default is tab. Space or other characters with special meaning to the shell must be quoted. -flist The list following -f is a list of fields assumed to be separated in the file by a delimiter character (see -d). For example, -f1,7 copies the first and seventh field only. Lines with no field delimiters will be passed through intact (useful for table subheadings), unless -s is specified. -s Suppresses lines with no delimiter characters in case of -f option. Unless specified, lines with no delimiters Printed 5/12/88 1
CUT(1) COMMAND REFERENCE CUT(1) will be passed through untouched. Either the -c or -f option must be specified. EXAMPLES cut -d: -f1,5 /etc/passwd This next example maps user IDs to names to set name to current loginname: name=who am i | cut -f1 -d" " RETURN VALUE [NO_ERRS] Command completed without error. [USAGE] Incorrect command line syntax. Execution terminated. [NP_ERR] An error occurred that was not a system error. Execution terminated. [P_ERR] A system error occurred. Execution terminated. See intro(2) for more information on system errors. CAVEATS Line length is limited to 1023 characters. An error will be produced if a line of greater length is encountered. SEE ALSO awk(1), comm(1), egrep(1), fgrep(1), grep(1), join(1), look(1), paste(1), sort(1), and uniq(1). Printed 5/12/88 2
%%index%% na:216,104; sy:320,370; de:690,1115; op:1805,2022;4115,135; ex:4250,271; rv:4521,555; ca:5076,203; se:5279,309; %%index%%000000000145