chop

Section: User Commands (1)
Updated: Local
Index Return to Main Contents
 

NAME

chop - extract selected fields or columns of text lines  

SYNOPSIS

chop -flist [ -dseparators ] [ -b ] [ file ... ]
chop -clist [ file ... ]  

DESCRIPTION

Chop extracts selected fields or columns of lines from the specified files or the standard input, and writes them to the standard output. If you specify -f, chop extracts fields. If you specify -c, chop extracts columns.

Fields and columns are numbered from 1. A list of fields or columns consists of one or more ranges separated by commas. A range is a single number or a minus sign with a number at one or both ends. An open range runs to the corresponding end of the line; for instance, -3 is the same as 1-3, and 5- means all fields or columns from 5 onward. An input line ends with a newline, a carriage return, or a form feed.

For the -f option, the default input separator is white space, and the default output separator is the horizontal tab. Use the -d option to specify an alternate set of input separators; the first of them will be used on output. If you use the -d option, every occurrence of an input separator delimits a field. If you do not specify -d, leading white space in a line is normally ignored. To treat leading white space as a separator, specify -b.

For the -c option, a backspace character decrements the column, and a horizontal tab advances to the next standard 8-column tab stop.  

DIAGNOSTICS

Exits with status 0 on success, 1 on invalid syntax, and 2 if it cannot read an argument file.  

NOTES

Chop is meant to improve on cut(1). It has no limit on input line width or backspacing, lets many characters be input separators at once, and accepts white space as an input separator. It is not wholly compatible with cut; in particular, it processes all input lines the same way.  

SEE ALSO

cut(1), paste(1), awk(1)  

PROVIDER

G. L. Sicherman (odyssey!gls)


 

Index

NAME
SYNOPSIS
DESCRIPTION
DIAGNOSTICS
NOTES
SEE ALSO
PROVIDER

This document was created by man2html, using the manual pages.
Time: 06:20:45 GMT, December 12, 2024