![]() |
| ||
| Unixx shel script - combing information from 2 files into one useing looping structur 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.. |
| ||
| 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 |
| ||
| 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? |
| ||
| 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 |
| ||
| 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 |
| ||
| 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 |
| ||
| Re: Unixx shel script - combing information from 2 files into one useing looping structur yes how do I copy and paste it in word |
| ||
| 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 |
| ||
| 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 |
| ||
| 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. while read -r name number |
| ||
| Re: Unixx shel script - combing information from 2 files into one useing looping structur can u explain this code please. |
| ||
| Re: Unixx shel script - combing information from 2 files into one useing looping structur while read -r name number Basically, this pseudo code is reading the first file and grabbing the two variables, and for each line read from the first file, it's checking every line in the second file and, if the name matches, it's print the output in the format you specified to stdout. If you need Monday to equal Mon, etc, you can do that pretty easily with sed or even cut, if you know you only need a certain number of characters in your abbreviation (like if your standard is always 3 - Monday = Mon, Tuesday = Tue, etc) Hope that helps. Give it a shot and see what you can do with it. Remember, the code posted is pseudo-code which means it's not entirely "correct" (won't just work if you cut-and-paste it) and is meant to demonstrate a principal and provide a means to reaching the answer rather than being the answer itself. Best wishes, , Mike |
| ||
| Re: Unixx shel script - combing information from 2 files into one useing looping structur BTW, Just a friendly tip. You might want to kill the other 3 or 4 identical posts you have in this forum or an admin might delete them all. Just trying to help out so you don't get bumped off. Hope you get your problem solved soon :) , Mike |
| ||
| Re: Unixx shel script - combing information from 2 files into one useing looping structur I wished I had seen this post earlier. Cause I had the same home work in my unix class. It took me a good while, but I got it working with the for loop. Anywho, happy scripting!... |
| All times are GMT -4. The time now is 6:07 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC