Advertisement

06.24.2008 at 01:57AM PDT, ID: 23510252
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

Text manipulation using multiple files

Asked by sunnycoder in Perl Programming Language, Scripting Languages, Shell Scripting

Tags:

I need a script that works as follows

Input is a continuous stream of records (not infinite but this is going to be very voluminous - in TBs). Each record consists of n fields - tab separated. n is not known in advance but all records will have same number of fields. This input is received on stdin

There are several files, file1, file2, file3 ... each file is composed of two columns, sort of key value pairs separated by a space

script executed as
./myscript column1 file1 column2 file2 ... columnk filek

For each input record script will
   - extract the value in column1, search for this value in file1. If value is found (it would be in col1 of file1) append the value in col2 of file1 to the current record. If not found, append a sentinnel string "UNKNOWN" without the quotes
   - extract the value in column2, search for this value in file2. If value is found (it would be in col1 of file2) append the value in col2 of file2 to the current record. If not found, append a sentinnel string "UNKNOWN" without the quotes
   ...
   - extract the value in columnk, search for this value in filek. If value is found (it would be in col1 of filek) append the value in col2 of filek to the current record. If not found, append a sentinnel string "UNKNOWN" without the quotes

e.g.

file1
Adam     25
Brain      32
Chris      22

file2
Brain     CS
Chris     SS

File3
Adam    NY
Brain     MN
Chris     IN

./myscript 1 File3 2 File2 1 File1

Input record
Adam     student     UCB
would output
Adam     student     UCB     NY     UNKNOWN     25

Can use a solution in Perl/awk/bash.

Thanks!!Start Free Trial
[+][-]06.24.2008 at 02:12AM PDT, ID: 21853645

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.24.2008 at 02:21AM PDT, ID: 21853686

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.24.2008 at 02:39AM PDT, ID: 21853773

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.24.2008 at 02:56AM PDT, ID: 21853846

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.24.2008 at 03:33AM PDT, ID: 21854066

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.24.2008 at 03:54AM PDT, ID: 21854246

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.24.2008 at 03:57AM PDT, ID: 21854260

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.24.2008 at 03:59AM PDT, ID: 21854273

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.24.2008 at 04:07AM PDT, ID: 21854319

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.24.2008 at 04:10AM PDT, ID: 21854335

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.24.2008 at 04:16AM PDT, ID: 21854367

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Perl Programming Language, Scripting Languages, Shell Scripting
Tags: Perl
Sign Up Now!
Solution Provided By: ozo
Participating Experts: 1
Solution Grade: A
 
 
[+][-]06.24.2008 at 04:18AM PDT, ID: 21854372

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.24.2008 at 07:59PM PDT, ID: 21862399

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628