LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-05-2011, 08:18 PM   #1
vinnat
LQ Newbie
 
Registered: Aug 2011
Posts: 4

Rep: Reputation: Disabled
Bash or Perl Script - recursive search.


I need the help of this forum.
I have a text table which has only two fields: “Student Name” and “Test approved”. This table lists all the students that have approved different tests, but only 3 tests are mandatory (necessary) to be promoted, which are: “test_1” ; “ test_2” and “ test_3” .
The remaining tests (like “test_4”; “test_5”, etc.) are optional, because they are not necessary for a student to be promoted.

I need a script (Bash or Perl, etc. or Excel or Access) to accomplish the task of adding to the table a third field “Final Result”, having the result of the recursive search that has to be done.

This field, “Final Result”, can only have one of the following possible results:

• “Promoted” : only if test_1 AND test_2 AND test_3 were approved.
• “Not_Promoted_Fail Test_1” : because has failed test_1, even if has approved other mandatory tests or optional tests.
• “Not_Promoted_Fail Test_2” : because has failed test_2, even if has approved test_1 and test_3, or other optional tests.
• “Not_Promoted_Fail Test_3” : because has failed test_3”, even if has approved test_1 and test_2.

This is the final result (a new text table with 3 fields) which I need:

"Student Name" "Test approved" "Final Result"
Peter Test_1 Promoted
Peter Test_5 Promoted
Peter Test_3 Promoted
Peter Test_2 Promoted
John Test_3 Promoted
John Test_2 Promoted
John Test_1 Promoted
John Test_6 Promoted
Mary Test_4 Not_Promoted_Fail Test_2
Mary Test_1 Not_Promoted_Fail Test_2
Mary Test_3 Not_Promoted_Fail Test_2
Mary Test_7 Not_Promoted_Fail Test_2
Mary Test_5 Not_Promoted_Fail Test_2
Mary Test_6 Not_Promoted_Fail Test_2
Robert Test_2 Not_Promoted_Fail Test_1
Robert Test_3 Not_Promoted_Fail Test_1
Jane Test_1 Not_Promoted_Fail Test_3
Jane Test_2 Not_Promoted_Fail Test_3
Jane Test_7 Not_Promoted_Fail Test_3

Many thanks to all of you!

Vincenzo Natale (Argentina)
vinnat@speedy.com.ar
 
Old 10-06-2011, 09:51 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,919

Rep: Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689
Quote:
Originally Posted by vinnat View Post
I need the help of this forum.
I have a text table which has only two fields: “Student Name” and “Test approved”. This table lists all the students that have approved different tests, but only 3 tests are mandatory (necessary) to be promoted, which are: “test_1” ; “ test_2” and “ test_3” .
The remaining tests (like “test_4”; “test_5”, etc.) are optional, because they are not necessary for a student to be promoted.

I need a script (Bash or Perl, etc. or Excel or Access) to accomplish the task of adding to the table a third field “Final Result”, having the result of the recursive search that has to be done.

This field, “Final Result”, can only have one of the following possible results:

• “Promoted” : only if test_1 AND test_2 AND test_3 were approved.
• “Not_Promoted_Fail Test_1” : because has failed test_1, even if has approved other mandatory tests or optional tests.
• “Not_Promoted_Fail Test_2” : because has failed test_2, even if has approved test_1 and test_3, or other optional tests.
• “Not_Promoted_Fail Test_3” : because has failed test_3”, even if has approved test_1 and test_2.

This is the final result (a new text table with 3 fields) which I need:

"Student Name" "Test approved" "Final Result"
Peter Test_1 Promoted
We will certainly be glad to HELP you. Post what you've written so far, and where you're stuck, along with a sample of the input data, and we can assist. However, we are NOT going to write your scripts for you....we will be very happy to work with you to get things going, but you will have to put effort into this on your own.

I suggest you check out the bash scripting guide, if you need help getting started. Covers opening files, reading them, and writing tests.
http://tldp.org/LDP/abs/html/

If you would like someone to write programs for you, feel free to post this job listing in the LQ Job Marketplace, with how much you're willing to pay.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with recursive bash script me4linux Programming 6 03-20-2007 06:46 AM
Help with a recursive chmod script in bash lowpro2k3 Programming 11 07-25-2005 08:03 PM
Recursive search in bash scripting ! zulfilee Linux - Software 3 12-12-2004 11:40 PM
writing perl script to search forums qcoder Programming 2 07-13-2004 07:10 AM
modify bash script - recursive action xscousr Programming 6 09-17-2003 02:52 PM


All times are GMT -5. The time now is 11:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration