0% found this document useful (0 votes)
12 views

Commands

This document provides usage examples and descriptions of the cut command line utility. It can select specific bytes, characters, or fields from each line of files or standard input using ranges, delimiters, and complements. Output is written in the same order as input, with the input delimiter or a custom output delimiter. Redirectors like >, >>, 2>, and < are also described for directing command output and input.

Uploaded by

bakkefufya
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Commands

This document provides usage examples and descriptions of the cut command line utility. It can select specific bytes, characters, or fields from each line of files or standard input using ranges, delimiters, and complements. Output is written in the same order as input, with the input delimiter or a custom output delimiter. Redirectors like >, >>, 2>, and < are also described for directing command output and input.

Uploaded by

bakkefufya
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

cut OPTION... [FILE]...

-b, --bytes=LIST
Select only these bytes

CUT
$cut -b N,M [FILE]
$cut --characters=N,M [FILE]

-c, --characters=LIST
Select only these characters

$cut -c N,M [FILE]


$cut --bytes=N,M [FILE]

-d, --delimiter=DELIM
Use DELIM instead of TAB for field delimiter

$cut -d ‘ ’ -f N,M [FILE]


$cut --delimiter=‘ ’ -f N,M [FILE]

-f, --fields=LIST
Select only these fields; also print any line
that contains no delimiter character, unless the
-s option is specified

$cut -d ‘ ’ -f N,M [FILE]


$cut -d ‘ ’ --fields=N,M [FILE]

--complement
complement the set of selected bytes, characters
or fields

$cut -d ' ' -f N --complement [FILE]


--output-delimiter=STRING
use STRING as the output delimiter the default is
to use the input delimiter

CUT
$cut -d ‘ ’ -c N,M --output-delimiter=‘-’

Use one, and only one of -b, -c or -f. Each LIST


is made up of one range, or many ranges
separated by commas.
Selected input is written in the same order
that it is read, and is written exactly
once. Each range is one of:

N N'th byte, character or field,


counted from 1.
N,M N'th and M'th byte, character or
field.
N- From N'th byte, character or field,
to end of line.
N-M From N'th to M'th (included) byte,
character or field.
-M From first to M'th (included) byte,
character or field.
OPERATORS
REDIRECTION
> Redirect STDOUT to specified file. If file exists,
overwrite it. If it does not exist, create it.

>> Redirect STDOUT to specified file. If file exists,


append to it. If it does not exist, create it.

2> Redirect STDERR to specified file. If file exists,


overwrite it. If it does not exist, create it.

2>> Redirect STDERR to specified file. If file exists,


append to it. If it does not exist, create it.

&> Redirect STDOUT and STDERR to specified file. If


file exists, overwrite it. If it does not exist,
create it.

&>> Redirect STDOUT and STDERR to specified file. If


file exists, append to it. If it does not exist,
create it.

< Redirect STDIN from specified file into command.

<> Redirect STDIN from specified file into command


and redirect STDOUT to specified file.

You might also like