For example, if i run df -h
Filesystem Size Used Avail Use% Mounted on
udev 985M 0 985M 0% /dev
tmpfs 201M 9.1M 192M 5% /run
/dev/sdb3 87G 26G 57G 31% /
tmpfs 1003M 15M 989M 2% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 1003M 0 1003M 0% /sys/fs/cgroup
From its output if i want to print a line
/dev/sdb3 87G 26G 57G 31% /
that contain root partition /
.
Then How to do it with awk?
I do not want to use /dev/sdb3
in search pattern. In search pattern, use only /
.
I've tried answer posted on Stackoverflow but it did not work.
You should use plain
df
:However, in awk, since this is the last field, just compare directly: