cut COMMAND:
cut command is used to cut out selected fields of each line of a file. The cut command uses delimiters to determine where to split fields.
SYNTAX:
The Syntax is
cut [options]
OPTIONS:
-c
Specifies character positions.
-b
Specifies byte positions.
-d flags
Specifies the delimiters and fields.
EXAMPLE:
Lets create a file file1.txt and let it have the following data:
Data in file1.txt
This is, an example program,for cut command.
cut -c1-3 text.txt
Output:
Thi
Cut the first three letters from the above line.
cut -d, -f1,2 text.txt
Output:
This is, an example program
The above command is used to split the fields using delimiter and cut the first two fields.
Find LINUX Commands... Hope you enjoy this tutorial. We welcome your Valuable feedbacks or suggestions on this LINUX / UNIX cmd reference. This is a copyright content.