Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cut(1) — A/UX 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

awk(1)

colrm(1)

grep(1)

paste(1)

sed(1)




cut(1) cut(1)
NAME cut - cuts out selected fields of each line of a file SYNOPSIS cut -clist [-s] [file]... cut -flist [-d char] [-s] [file]... ARGUMENTS -clist Specifies character positions (e.g., -c1-72 would pass the first 72 characters of each line). list is a comma-separated list of integer field numbers (in increasing order), with optional - to indicate ranges as in the -o option of nroff/troff for page ranges; e.g., 1,4,7; 1-3,8; -5,10 (short for 1-5,10); or 3- (short for third through last field). -d char Specifies the field delimiter. Used with the -f option only. The default is tab. Space or other characters with special meaning to the shell must be quoted. file Specifies the file to be affected. If no files are given, the standard input is used. -flist Specifies a list of fields assumed to be separated in the file by a delimiter character (see -d); e.g., -f1,7 copies the first and seventh fields only. Lines with no field delimiters will be passed through intact (useful for table subheadings), unless the -s option is specified. list is a comma-separated list of integer field numbers (in increasing order), with optional - to indicate ranges as in the -o option of nroff/troff for page ranges; e.g., 1,4,7; 1-3,8; -5,10 (short for 1-5,10); or 3- (short for third through last field). -s Suppresses lines with no delimiter characters in case of -f option. Unless specified, lines with no delimiters will be passed through untouched. DESCRIPTION cut cuts out columns from a table or fields from each line of a file; in database parlance, it implements the projection of a relation. The cut command may be used as a filter. The fields as specified by list in the -c and -f options may be fixed length, i.e., character positions as on a punched card (-c option) or the length may vary from line to line and be marked with a field delimiter character like TAB (-f January 1992 1



cut(1) cut(1)
option). Use grep(1) to make horizontal cuts (by context) through a file, or paste(1) to put files together column-wise (i.e., horizontally). To reorder columns in a table, use cut and paste. EXAMPLES Use the command for: cut -d: -f1,5 /etc/passwd mapping user IDs to names. Use the command: name=`who am i | cut -f1 -d" "` to set name to current login name. STATUS MESSAGES AND VALUES Line too long A line can have no more than 1023 characters or fields. Bad list for c/f option Missing the -c or -f option or incorrectly specified list. No error occurs if a line has fewer fields than the list calls for. No fields The list is empty. FILES /usr/bin/cut Executable file SEE ALSO awk(1), colrm(1), grep(1), paste(1), sed(1) 2 January 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026