--S1BNGpv0yoYahz37
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Aug 12, 2002 at 11:41:29PM +0900, Chris Morris wrote:
> I have a huge data file with rows like this:
>=20
> AL Prattville  36066  01001 US  01-001-0870 01 001 1 3 0162328 1
> AL Prattville  36067  01001 US  01-001-0870 01 001 1 3 0162328 1
> AL Prattville  36068  01001 US  01-001-0870 01 001 1 3 0162328 1
>=20
> The unique key for each row is all columns. I'd like to generate a single
> column unique key that's derived from all the data, so a simple sequential
> number primary key won't do. Any tips on how I could do this in Ruby?

Make a hash sum over the data:

require 'md5'
unique_key =3D MD5.new(line)

-billy.


--=20
Meisterbohne       S=F6flinger Stra=DFe 100          Tel: +49-731-399 499-0
   eL=F6sungen       89077 Ulm                     Fax: +49-731-399 499-9

--S1BNGpv0yoYahz37
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iD8DBQE9V81TfBriNoqItSYRAgGHAJ9tm66kJsmU6LschwpMUStMQPsmEACfZI8D
X7PSgWb0/EzqG+0xA9MyXL8=
=ET02
-----END PGP SIGNATURE-----

--S1BNGpv0yoYahz37--
On Mon, Aug 12, 2002 at 11:41:29PM +0900, Chris Morris wrote:
> I have a huge data file with rows like this:
>=20
> AL Prattville  36066  01001 US  01-001-0870 01 001 1 3 0162328 1
> AL Prattville  36067  01001 US  01-001-0870 01 001 1 3 0162328 1
> AL Prattville  36068  01001 US  01-001-0870 01 001 1 3 0162328 1
>=20
> The unique key for each row is all columns. I'd like to generate a single
> column unique key that's derived from all the data, so a simple sequential
> number primary key won't do. Any tips on how I could do this in Ruby?

Make a hash sum over the data:

require 'md5'
unique_key =3D MD5.new(line)

-billy.


--=20
Meisterbohne       S=F6flinger Stra=DFe 100          Tel: +49-731-399 499-0
   eL=F6sungen       89077 Ulm                     Fax: +49-731-399 499-9
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9V81TfBriNoqItSYRAgGHAJ9tm66kJsmU6LschwpMUStMQPsmEACfZI8D
X7PSgWb0/EzqG+0xA9MyXL8=
=ET02
-----END PGP SIGNATURE-----