943,809 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Apr 9th, 2008
0

Unixx shel script - combing information from 2 files into one useing looping structur

Expand Post »
HEY, I am new at this but I am in a middle of an excercise for an online class I am taking and I am doing a exercise and I am stuck. the instruction are as follow

: write a shell script that will take information from 2 fles and comine into another file
use looping structure


the files are
1) names with dates
2)same names with numebrs


and the out put should be
in order by date "ex monday, tuesday..
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cyberman111 is offline Offline
24 posts
since May 2007
Apr 9th, 2008
0

Re: Unixx shel script - combing information from 2 files into one useing looping structur

I have the files inputed but I just dont know what loop statement to use and to get it to print it in a file in order by date
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cyberman111 is offline Offline
24 posts
since May 2007
Apr 9th, 2008
0

Re: Unixx shel script - combing information from 2 files into one useing looping structur

what have you learnt in that online class so far? do you have lecture notes and books for shell scripting?
Reputation Points: 75
Solved Threads: 44
Junior Poster
ghostdog74 is offline Offline
156 posts
since Apr 2006
Apr 9th, 2008
0

Re: Unixx shel script - combing information from 2 files into one useing looping structur

yes I do , I ahve read the looping chapter but dont really understand which loops to use cause the examples are different
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cyberman111 is offline Offline
24 posts
since May 2007
Apr 9th, 2008
0

Re: Unixx shel script - combing information from 2 files into one useing looping structur

try this document instead. almost all you need to know about shell
Reputation Points: 75
Solved Threads: 44
Junior Poster
ghostdog74 is offline Offline
156 posts
since Apr 2006
Apr 9th, 2008
0

Re: Unixx shel script - combing information from 2 files into one useing looping structur

Hey There,

Do you have a skeleton of a script. Just whatever you tried that isn't working? If you post that here, more folks are likely to respond and get you to the answer you need quickly.

Best wishes,

Mike
Reputation Points: 102
Solved Threads: 47
Posting Whiz
eggi is offline Offline
399 posts
since Oct 2007
Apr 9th, 2008
0

Re: Unixx shel script - combing information from 2 files into one useing looping structur

yes how do I copy and paste it in word
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cyberman111 is offline Offline
24 posts
since May 2007
Apr 9th, 2008
0

Re: Unixx shel script - combing information from 2 files into one useing looping structur

SEE THE THING IS, i HAVE 2 FILES ONE WITH NAMES WITH DAYS AND THE OTHER WITH NAMES AND NUMBERS. SOMEHOW I NEED TO TAKE INFORMATION FROM BOTH FILES AND PUT IT IN ONE FILE USING LOOP STATEMENT. I HAVE NO CLUE WEHRE TO START I MADE THE FILES BUT NOW IM STUCK ON THE PATH TO TAKE
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cyberman111 is offline Offline
24 posts
since May 2007
Apr 10th, 2008
0

Re: Unixx shel script - combing information from 2 files into one useing looping structur

Please help!!!!
ok
the first file is this

dave 734
bob 313
carol 248
mary313
ted248


the second file is
bob tuesday
carol monday
ted sunday
alice wed
dave thurs

the output has to be

name on call phone
carol mon 248
bob tues 313
alice wed 616

etc...

i need to put this in one file using looop structure
i have no clue how to do this
i made the 2 files and now im just confused and really depressed. i cant seem to fig out wat to do next
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cyberman111 is offline Offline
24 posts
since May 2007
Apr 10th, 2008
0

Re: Unixx shel script - combing information from 2 files into one useing looping structur

have you read the line i gave about while loops? pseudocode.
Shell Scripting Syntax (Toggle Plain Text)
  1. while read -r name number
  2. do
  3. while read -r NAME NUM
  4. do
  5. if NAME is equal name
  6. then
  7. echo name NUM number
  8. done < "file2"
  9. done < "file1"
Reputation Points: 75
Solved Threads: 44
Junior Poster
ghostdog74 is offline Offline
156 posts
since Apr 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: Required Hardware information in Linux & solaris.
Next Thread in Shell Scripting Forum Timeline: compare 2 files





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC