cut(1) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

cut(1)

cut(1)                           User Commands                          cut(1)



NAME
       cut - cut out selected fields of each line of a file

SYNOPSIS
       /usr/bin/cut -b list [-n] [file]...


       /usr/bin/cut -c list [file]...


       /usr/bin/cut -f list [-d delim] [-s] [file]...

DESCRIPTION
       cut  cuts  bytes, characters, or character-delimited fields from one or
       more files, and concatenates them on standard output.


       The option argument list is a comma-separated or  blank-separated  list
       of positive numbers and ranges. Ranges can be of three forms. The first
       is two positive integers separated by a hyphen (low-high), which repre‐
       sents all fields from low to high. The second is a positive number pre‐
       ceded by a hyphen (-high), which represents all fields from field 1  to
       high.  The last is a positive number followed by a hyphen (low-), which
       represents all fields from low to the last field,  inclusive.  Elements
       in  the list can be repeated, can overlap, and can appear in any order.
       The order of the output is that of the input.


       One and only one of -b, -c, or -f options must be specified.


       If no file is given, or if the file is -, cut cuts from standard input.
       The start of the file is defined as the current offset.

OPTIONS
       The following options are supported:

       -b list

           The  list  following  -b  specifies  byte  positions (for instance,
           -b1-72 would pass the first 72 bytes of each line). When -b and  -n
           are  used together, list is adjusted so that no multibyte character
           is split.


       -c list

           The list following -c specifies character positions (for  instance,
           -c1-72 would pass the first 72 characters of each line).


       -d delim

           The character following -d is the field delimiter (-f option only).
           The default is TAB. Space or other characters with special  meaning
           to the shell must be quoted. delim can be a multibyte character.


       -f list

           The  list  following -f is a list of fields assumed to be separated
           in the file by a delimiter character (see -d); for instance,  -f1,7
           copies the first and seventh field only. Lines with no field delim‐
           iters are passed through intact  (useful  for  table  subheadings),
           unless -s is specified.


       -n

           Do  not  split  characters.  When -b list and -n are used together,
           list is adjusted so that no multibyte character is split.


       -s

           Suppresses lines with no delimiter characters in case of -f option.
           Unless  specified,  lines  with  no  delimiters  is  passed through
           untouched.


OPERANDS
       The following operands are supported:

       file    A path name of an input file. If no file  operands  are  speci‐
               fied, or if a file operand is -, the standard input is used.


EXAMPLES
       Example 1 Mapping user IDs



       A mapping of user IDs to names follows:


         example% cut -d: -f1,5 /etc/passwd


       Example 2 Setting the Current login name



       To set name to current login name:


         example$ name=$(who am i | cut -f1 -d' ')


ENVIRONMENT VARIABLES
       See  environ(7) for descriptions of the following environment variables
       that affect the execution of cut: LANG, LC_ALL, LC_CTYPE,  LC_MESSAGES,
       and NLSPATH.

EXIT STATUS
       The following exit values are returned:

       0     All input files were output successfully.


       >0    An error occurred.


ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       tab()  box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
       TRIBUTE VALUE _ Availabilitysystem/core-os  _  CSIEnabled  _  Interface
       StabilityCommitted _ StandardSee standards(7).


SEE ALSO
       grep(1), paste(1), attributes(7), environ(7), standards(7)



Oracle Solaris 11.4               11 May 2021                           cut(1)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3