Re: Recomended tutoial(s) on doing arithmetic in Bash scripts
Greg Wooledge wrote on 03/06/17 14:38:
> On Sun, Mar 05, 2017 at 05:25:49PM +0100, tomas@tuxteam.de wrote:
>> If you need floating point numbers, bc (or dc) are your next stops.
>
> Or awk. For some problems, awk is fantastic.
>
Yes, it helps to sample the number of "bytes" like so:
owl1=$(awk '/usb0/ {print $2}' /proc/net/dev)
# insert process to be measured
bytes=$(awk "/usb0/ {print (\$2 - $owl1)}" /proc/net/dev)
Regards,
jvp.
Reply to: