Hi,

Ok, so I see my question was unclearly posed.  Here's what I want to do:

I have two tab-delimited text files.

File one:
  column 1: UNIQUE identifiers (about 40,000), one identifier per line.
  column 2:  some description of the identifier (let's say, red, green or blue).

      For example, the 9th identifier down might be 'hat' and it's
description in the next column over is 'blue'.

File two:
  column 1:  a subset of the identifiers found in file one, column 1
(about 1,000)

This is what I would like to do:

Make a second column in file 2 with the correct description to the
identifier as described in the master file (file 1).

So, in the end, my second file should have the following TWO columns:
  column 1:  a subset of the identifiers found in file one, column 1
(about 1,000)
  colum 2:  the appropriate description (red, green or blue) as
instructed by file 1.

vlookup in excel can do this for me, but it is very slow.  So, if i
had a perl script that can let me achieve my goal, i am sure it will
be faster.  Any help would be greatly appreciated.

Sanjay

On 2/2/06, Chris Devers <[EMAIL PROTECTED]> wrote:
> On Thu, 2 Feb 2006, Sanjay Chandriani wrote:
>
> > I am a perl newbie, so pardon my question if it is super easy.  I used
> > to routinely use Microsoft excel to do my vlookup's on a PC.
> > Recently, I got a new Apple computer and the vlookup function on Mac's
> > excel is unbearably slow.  I often do vlookup's for a column of
> > identifiers that is 40K long. This can take 30 minutes!!  I figured
> > there has to be a perl script out there that will do this for me, but
> > I haven't been able to find one by google-ing.  I wish i could write
> > it myself, but I am only on the 3rd chapter of the llama book!  :)
> >
> > Any help would be greatly appreciated.
>
> Part of the trick in asking good questions is to explain any jargon.
>
> What's a vlookup ?
>
> The Excel help file says, in part:
>
>     VLOOKUP
>     Searches for a value in the leftmost column of a table, and then
>     returns a value in the same row from a column you specify in the
>     table. Use VLOOKUP instead of HLOOKUP when your comparison values
>     are located in a column to the left of the data you want to find.
>
> By contrast...
>
>     HLOOKUP
>     Searches for a value in the top row of a table or an array of
>     values, and then returns a value in the same column from a row you
>     specify in the table or array. Use HLOOKUP when your comparison
>     values are located in a row across the top of a table of data, and
>     you want to look down a specified number of rows. Use VLOOKUP when
>     your comparison values are located in a column to the left of the
>     data you want to find. The H in HLOOKUP stands for "Horizontal."
>
> Ok, so... your data is in Excel, and you're working on a Mac, and you
> want to do this vlookup operation or an equivalent using Perl? Yes?
>
> I suspect it will be easier to help you if you give us a clear idea of
> what your data is, how it's being stored (Excel, or other), what you
> need to accomplish with your data, and -- most important -- what you
> have tried so far.
>
>
>
> --
> Chris Devers
> DO NOT LEAVE IT IS NOT REAL
>

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to