w3reference home
Linux Commands Tutorial


Bookmark and Share

cut

cut options [files]
Cut out selected columns or fields from one or more files. In the following options, list is a sequence of integers. Use a comma between separate values, and a hyphen to specify a range (e.g., 1-10,15,20 or 50-). See also paste and join.

Options
-b list, --bytes list Specify list of positions; only bytes in these positions will be printed.
-c list, --characters list Cut the column positions identified in list. Column numbers start with 1.
-d c, --delimiter c Use with -f to specify field delimiter as character c (default is tab); special characters (e.g., a space) must be quoted.
-f list, --fields list Cut the fields identified in list.
-n Don't split multibyte characters.
-s, --only-delimited Use with -f to suppress lines without delimiters.
--output-delimiter=string Use string as the output delimiter. By default, the output delimiter is the same as the input delimiter.
--help Print help message and exit.
--version Print version information and exit.


Examples
Extract usernames and real names from /etc/passwd:
cut -d: -f1,5 /etc/passwd

Find out who is logged on, but list only login names:
who | cut -d" " -f1

Cut characters in the fourth column of file, and paste them back as the first column in the same file:
cut -c4 file | paste - file
Code Validator
Learn FTP
Color finder
Link Checker
Free web designs
Coming soon!
Interview Questions...
'w3reference : Learn by examples ... Advanced to beginner's tutorials ...'
Ajax: AJAX tutorial1 | Apache: Apache HTTP Server | Restarting Apache | CSS: CSS Border | CSS Syntax | CSS Selector | CSS Comment | CVS: CVS Release | CVS Login | CVS Logout | CVS Annotate | Databases: Rolap Tutorial | OLAP Tutorial | OLTP Tutorial | data warehousing | Expect: HTML: html | Linux: Dot (.) conf files | Linux Mount Point | Linux Filesystem | SSH Tutorial | Linux Commands: cal | cat | cfdisk | chroot | MySQL: MySQL Commands | PHP: PHP Basics | PHP Variables | PHP Output (echo/print) | PHP String Concat | PL/SQL: PL/SQL Data Types | PL/SQL Control Structures | PL/SQL File Extensions | PL/SQL DBMS_OUTPUT package | Python: My first Python program | Shell: Starting Bash | Bash Redirection | Bash Pipes | Bash Variables | SQL: SQL Transactions | SQL Constraints | SQL Drop | SQL Union & Union All | SVN: svn architecture | SVN Repository | SVN Import | SVN Checkout | Tech: soap | Web Designing: Web Hosting | HTML/XHTML/CSS code validator | Learn FTP | Search Engine Optimization Tips | www: XML: XML vs HTML | XML Syntax | XML Tags, Elements and Attributes | XML Namespaces |
Sitemap | Disclaim | Privacy Policy | Contact | ©2007-2009 w3reference.com All Rights Reserved.