He hecho ifconfig:
eth0 Link encap:Ethernet HWaddr 70:5a:b6:43:54:7b
inet addr:192.168.0.2 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::725a:b6ff:fe43:547b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9445 errors:0 dropped:0 overruns:0 frame:0
TX packets:8969 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6807161 (6.4 MiB) TX bytes:1749550 (1.6 MiB)
Interrupt:16
Ejecuto el comando:
ifconfig eth0|grep HWaddr|cut -d " " -f 11
y me da
70:5a:b6:43:54:7b
El 11 qué indica exactamente? Se supone que es la columna, pero si quito la tabulación, no debería ser la columna 4?
No entiendo, alguien me lo puede explicar?
Citar-d delim
Use delim as the field delimiter character instead of the tab
character.
Citar-f list
The list specifies fields, separated in the input by the field
delimiter character (see the -d option.) Output fields are sepa-
rated by a single occurrence of the field delimiter character.
el 11 es la posición,no es exactamente una tabla por lo que veo.
ifconfig eth0|grep HWaddr|cut -d " " -f 1
mostraría
eth0
posición 2,3,4,5,6 en blanco
y
ifconfig eth0|grep HWaddr|cut -d " " -f 1
muestra:
Link
Por lo tanto encap:Ethernet 8, 9 espacio en blanco, 10 Hwaddr y 11 la mac xD
Sigo sin entenderlo. Según mi lógica de ver el comando, cuando pones -d " " estás separando columnas, entonces las tabulaciones se quedan en un solo espacio, entonces por qué siguen habiendo tantas posiciones vacías (2,3,4,5 y 6)?