I usually seem to remember things best if I "play" with them, to see how they behave under different circumstances.
So I put the one line
grep'ed from your
ifconfig output:
Code:
eth0 Link encap:Ethernet Hwaddr OO:OC:76:96:A3:73
in a file named
ifconfig_data.txt, then show different variations of the
cut like the following.
The command sequence:
Code:
cat ifconfig_data.txt | cut -d ":" -f 1-3
produces this output:
Quote:
eth0 Link encap:Ethernet Hwaddr OO:OC
|
The command sequence:
Code:
cat ifconfig_data.txt | cut -d ":" -f 1-2
produces this output:
Quote:
eth0 Link encap:Ethernet Hwaddr OO
|
The command sequence:
Code:
cat ifconfig_data.txt | cut -d ":" -f 1-1
produces this output:
The command sequence:
Code:
cat ifconfig_data.txt | cut -d ":" -f 1
produces this output:
Hopefully from that you can see that the value for the -f option is either the "number" of a single field or a dash separated range of field numbers. The fields are numbered from 1 to however many there are on an input line. The fields are separated by the delimiter.
The command sequence:
Code:
cat ifconfig_data.txt | cut -d " " -f 5
produces this output:
HTH.