Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

Resolved Question

Simple Script

Apr 2, 2014 10:59AM PDT

Hello scripters.

I work in linux but by no means am a pro at this and I have probably a simple question for some of you.

I have a master list with two columns. First column is an alphanumerical value and the second column is a on or two word description.


When my data comes in it comes in as an alphanumeric in one column and number counts in the second column.


I would like to use my master list to rename the alphanumerics with word descriptors.

Master list
sdjh124312---------------Beans
fjnef3532------------------Bananas
kjdfjk532-------------------Pants
askljhsa12523------------Apples

Data comes in
sdjh124312---------------5
askljhsa12523------------9


I would like to have
Beans---------------5
Apples------------9

Discussion is locked

apricimo has chosen the best answer to their question. View answer
- Collapse -
Clarification Request
Where is the data
Apr 2, 2014 11:53PM PDT

stored, in what format, and what language are you scripting in?

~Sovereign

- Collapse -
Where is the data
Apr 3, 2014 2:08AM PDT

Stored as a text file

bash I guess... But really it's just altering the text files...


It's just a tab delimited text file with alphanumeric in first column and word descriptions in the second column

Same with the data file except the first column is alphanumeric and number of hits in the second column (just a numeric value).

Both tab delimited

- Collapse -
Figured it out
Apr 3, 2014 2:24AM PDT

Figured it out with vlookup Happy

Best Answer

- Collapse -
Re: script
Apr 3, 2014 12:03AM PDT

I'd use LibreOffice Calc. In essence, and using MS Excel terms, it's just a VLOOKUP. Excel is a perfect tool for that.
But any relational database that can import the data and export the results of a JOIN would be fine also. LibreOffice has one, but MySQL is free also.

But that's just my background. Why do you need a shell script?

Kees

- Collapse -
Script
Apr 3, 2014 2:06AM PDT

I don't care if it's a script or not... just how to do something like that...

If I have 10,000 alphanumerics I can do this with vlookup?

- Collapse -
Figured it out
Apr 3, 2014 2:24AM PDT

Thank you... VLOOKUP works Perrrrfect!

Thanks