I've just discovered this cool nifty and handy command that I think would help me a lot, but something it's not really clear to me though I've read some tutorials about it. I know if you wanna print the info of a column using awk you refer to that column using the dollar sign $, but I didn't get it how you can refer to a row or how can you refer to a certain value that it's situated in a matrix.
For example if I do df -H this pops out in my terminal
Code:
Filesystem Size Used Avail Use% Mounted on
/dev/sda10 48G 13G 33G 28% /
tmpfs 1006M 12K 1006M 1% /lib/init/rw
udev 1001M 288K 1001M 1% /dev
tmpfs 1006M 524K 1006M 1% /dev/shm
/dev/sda6 98G 77G 22G 79% /mnt/WD_1
/dev/sda7 98G 26G 73G 26% /mnt/WD_3
/dev/sda5 98G 53G 45G 55% /mnt/WD_kit
/dev/sda1 76G 45G 31G 60% /mnt/sda1
/dev/sda9 49G 27G 23G 55% /mnt/sda9
If I do df -H|awk '/ / {print $3}' it will show me the used space column
Code:
Used
14G
13k
295k
537k
83G
28G
57G
49G
29G
Ok now how can I make awk so it will diplay only the 26G used space of my sda7 without involving grep command 'cause I know another way it would be something like df -H|grep sda7|awk '/ / {print $3}', but because I need to get these values so I could perform calculations with them inside awk involving grep will only make things harder and awk-ard 8-)
So anybody has any idea how can I refer to a specific value from a matrix like display, using awk ?