Linux Shell Scripting Tutorial (LSST) v1.05r3 | ||
Chapter 5: Essential Utilities for Power User | ||
|
Command | Explanation |
cut | Name of cut utility |
-f1 | Using (-f) option, you are specifying the extraction field number. (In this example its 1 i.e. first field) |
sname | File which is used by cut utility and which is use as input for cut utility. |
You can redirect output of cut utility as follows
$cut -f2 sname > /tmp/sn.tmp.$$
$cut -f2 smark > /tmp/sm.tmp.$$
$cat /tmp/sn.tmp.$$
Vivek
Renuka
Prakash
Ashish
Rani
$cat /tmp/sm.tmp.$$
67
55
96
36
67
General Syntax of cut utility:
Syntax:
cut -f{field number} {file-name}
Use of Cut utility:
Selecting portion of a file.
Preparing for Quick Tour of essential utilities | Putting lines together using paste utility |