Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #178495

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

From <tomas@tuxteam.de>
Newsgroups linux.debian.user
Subject Re: Recomended tutoial(s) on doing arithmetic in Bash scripts
Date 2017-03-06 16:40 +0100
Message-ID <ti2TU-1G6-7@gated-at.bofh.it> (permalink)
References (2 earlier) <thIVb-49C-7@gated-at.bofh.it> <thGA1-2jU-5@gated-at.bofh.it> <thHcJ-2Sl-3@gated-at.bofh.it> <ti11M-rk-9@gated-at.bofh.it> <ti2hc-1cC-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Mar 06, 2017 at 03:50:06PM +0100, Jörg-Volker Peetz wrote:
> 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)

Yep to Greg and thanks to Jörg. And to those who say "Perl": again,
I'm a Perl fan, but awk is *much* nimbler than Perl and thus far a
better match as a toolset utility in a shell script's context.

regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAli9gY0ACgkQBcgs9XrR2kbDGACfZtsUq5bC0pgLDZsESy/NHCoa
mGkAnRabjRPiwTT2EERjVq5PUCnXyD2J
=cyV9
-----END PGP SIGNATURE-----

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Recomended tutoial(s) on doing arithmetic in Bash scripts Richard Owlett <rowlett@cloud85.net> - 2017-03-05 16:50 +0100
  Re: Recomended tutoial(s) on doing arithmetic in Bash scripts Reco <recoverym4n@gmail.com> - 2017-03-05 17:30 +0100
  Re: Recomended tutoial(s) on doing arithmetic in Bash scripts <tomas@tuxteam.de> - 2017-03-05 17:30 +0100
    Re: Recomended tutoial(s) on doing arithmetic in Bash scripts GiaThnYgeia <GiaThnYgeia@openmailbox.org> - 2017-03-05 19:20 +0100
      Re: Recomended tutoial(s) on doing arithmetic in Bash scripts <tomas@tuxteam.de> - 2017-03-05 21:40 +0100
      Re: Recomended tutoial(s) on doing arithmetic in Bash scripts Greg Wooledge <wooledg@eeg.ccf.org> - 2017-03-06 14:40 +0100
        Re: Recomended tutoial(s) on doing arithmetic in Bash scripts <tomas@tuxteam.de> - 2017-03-06 15:00 +0100
        Re: Recomended tutoial(s) on doing arithmetic in Bash scripts Jörg-Volker Peetz <jvpeetz@web.de> - 2017-03-06 16:00 +0100
          Re: Recomended tutoial(s) on doing arithmetic in Bash scripts <tomas@tuxteam.de> - 2017-03-06 16:40 +0100
    Re: Recomended tutoial(s) on doing arithmetic in Bash scripts Richard Owlett <rowlett@cloud85.net> - 2017-03-05 19:20 +0100
      Re: Recomended tutoial(s) on doing arithmetic in Bash scripts Richard Owlett <rowlett@cloud85.net> - 2017-03-05 19:50 +0100
      Re: Recomended tutoial(s) on doing arithmetic in Bash scripts <tomas@tuxteam.de> - 2017-03-05 21:30 +0100
        Re: Recomended tutoial(s) on doing arithmetic in Bash scripts Richard Owlett <rowlett@cloud85.net> - 2017-03-05 22:00 +0100
    Re: Recomended tutoial(s) on doing arithmetic in Bash scripts Jude DaShiell <jdashiel@panix.com> - 2017-03-05 23:20 +0100
      Re: Recomended tutoial(s) on doing arithmetic in Bash scripts Richard Owlett <rowlett@cloud85.net> - 2017-03-06 12:20 +0100
        Re: Recomended tutoial(s) on doing arithmetic in Bash scripts <tomas@tuxteam.de> - 2017-03-06 12:40 +0100
  Re: Recomended tutoial(s) on doing arithmetic in Bash scripts David Christensen <dpchrist@holgerdanske.com> - 2017-03-05 20:50 +0100
    Re: Recomended tutoial(s) on doing arithmetic in Bash scripts Richard Owlett <rowlett@cloud85.net> - 2017-03-05 21:50 +0100
      Re: Recomended tutoial(s) on doing arithmetic in Bash scripts David Christensen <dpchrist@holgerdanske.com> - 2017-03-06 04:40 +0100
    Re: Recomended tutoial(s) on doing arithmetic in Bash scripts <tomas@tuxteam.de> - 2017-03-05 22:30 +0100
  Re: Recomended tutoial(s) on doing arithmetic in Bash scripts Jude DaShiell <jdashiel@panix.com> - 2017-03-05 23:10 +0100

csiph-web