Reputation: 5689
I am trying to write program which will monitor number of operations on hard disk.
#!/bin/bash
while true;
do
operations=$(iostat -dx /dev/mapper/kaliMichu--vg-home)
echo "$operations"
sleep 5
done
So I used iostat for that. Actually I am only interested in some parameters for example w/s. How can I catch it's value into variable e.g WS=$w/s_value
Upvotes: 0
Views: 63
Reputation: 18351
#!/bin/bash
while true;
do
operations=$(iostat -dx /dev/mapper/kaliMichu--vg-home|awk 'NR>3{print $5}')
echo "$operations"
sleep 5
done
Here, awk
is filterning the desired column for you.
Upvotes: 2