[vox] vim magic

Karsten M. Self vox@lists.lugod.org
Sun, 22 Feb 2004 22:34:19 -0800


--GPJrCs/72TxItFYR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

on Mon, Feb 16, 2004 at 01:42:20PM -0800, Dylan Beaudette (dylan@iici.no-ip=
=2Eorg) wrote:
>=20
> > In this particluar instance, I was testing HD performance between 2
> > different kernels. I was booting each kernel and running the following:
> > hdparm -T /dev/hda | grep Timing | cut -d: -f2 | cut -d\=3D -f1
> > in a loop with the output going to a file, resulting in a file that
> > looked something like:
> >    724 MB in  2.01 seconds
> >    744 MB in  2.00 seconds
> > etc. A total for the columns would have let me calculate a quick
> > average.
> >=20
>=20
>=20
> why not use awk to do the summation:
> ...using whitespace as a delimeter $4 =3D time column
>=20
> awk '{x =3D x + $4} END {print x}' input_file
>=20
> ..output will be the sum of column 4

I've got the following as 'addup' (sum is a checksum program) which does
just that.  Invoke it from shell or within vim on a range of data.

---------------------------------------------------------------------------=
-----
#!/usr/bin/awk -f

{ total =3D total + $1 }
END { print total }
---------------------------------------------------------------------------=
-----


Peace.

--=20
Karsten M. Self <kmself@ix.netcom.com>        http://kmself.home.netcom.com/
 What Part of "Gestalt" don't you understand?
    It is kinda awkward to have this "vote stuffing" feature.
    - Diebold Electronic Voting Machine memos.
      http://www.scoop.co.nz/mason/stories/HL0309/S00106.htm

--GPJrCs/72TxItFYR
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAOZ7refG8443k044RAhWkAKCJWTUjDoJwl0FK11UkylY4YYAq6QCggj8V
mCySaU9WLCuWUv7IMb1KTro=
=Bkae
-----END PGP SIGNATURE-----

--GPJrCs/72TxItFYR--