How to produce a file by many files?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to produce a file by many files?
# 1  
Old 04-27-2009
How to produce a file by many files?

i got these files:

files: Prac1, Prac2, Prac3 (these 3 files have the same format), the format :
Prac1
20693680 10
20179687 9
20781637 5
21907894 6

Prac2
20693680 8
20179687 6
21907894 2

Prac3
20693680 8
21907894 9

file STUDENTS, the format:
20693680:familyname, firstname
20179687:familyname, firstname
20781637:familyname, firstname
21907894:familyname, firstname

How can i use these files to produce a file called MISSING that this file is finding out which ID number has miss out the prac in the file Prac1, Prac2 and Prac3? Using bourne shell script.

Output file called Missing:
Code:
20179687 Prac3
20781637 Prac2, Prac3

i am thinking of this

Code:
cat Students | while read Student_ID
for num in 1 2 3 #which is for Prac 1, Prac2 and Prac3
    # for line in (length of file)
    #while any line match with the Student_id
    #then print nothing
    #else print the Student_ID: Prac 1 or i ??
    #if there is a Prac after the Student_id
    #then need a , and then print the second one and third one
    #to a file called Missing
done

Can anyone please help me with this question?

Last edited by mingming88; 04-29-2009 at 08:53 AM.. Reason: added code tags
# 2  
Old 04-27-2009
what have you tried so far?
# 3  
Old 04-28-2009
Quote:
Originally Posted by Yogesh Sawant
what have you tried so far?
i still think of which files should i need for it. i am stuck on it. can you please help?
# 4  
Old 04-29-2009
can anyone help me with this question?
# 5  
Old 04-29-2009
Quote:
Originally Posted by mingming88
can anyone help me with this question?
Can you paste the actual output you are expecting from the above 3 files? This will help us design the solution for you.


cheers,
Devaraj Takhellambam
# 6  
Old 04-29-2009
Output file called Missing:
Code:
20179687 Prac2
20781637 Prac2, Prac3

# 7  
Old 04-29-2009
Quote:
Originally Posted by mingming88
Output file called Missing:
Code:
20179687 Prac2
20781637 Prac2, Prac3

20179687 doesn't seem to be present in prac3 also. How is this file derived from the above files
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Join two files combining multiple columns and produce mix and match output

I would like to join two files when two columns in each file matches with each other and then produce an output when taking multiple columns. Like I have file A 1234,ABCD,23,JOHN,NJ,USA 2345,ABCD,24,SAM,NY,USA 5678,GHIJ,24,TOM,NY,USA 5678,WXYZ,27,MAT,NJ,USA and file B ... (2 Replies)
Discussion started by: mady135
2 Replies

2. UNIX for Advanced & Expert Users

gzip vs pipe gzip: produce different file size

Hi All, I have a random test file: test.txt, size: 146 $ ll test.txt $ 146 test.txt Take 1: $ cat test.txt | gzip > test.txt.gz $ ll test.txt.gz $ 124 test.txt.gz Take 2: $ gzip test.txt $ ll test.txt.gz $ 133 test.txt.gz As you can see, gzipping a file and piping into gzip... (1 Reply)
Discussion started by: hanfresco
1 Replies

3. Red Hat

how to produce date command o/p

Hello I am trying of a solution to produce date cmnd o/p as: Feb 18 is the 049 day of the year. Any ideas how to produce this? (2 Replies)
Discussion started by: ranumala
2 Replies

4. Shell Programming and Scripting

get file content and produce command

hi buddies; ip.txt: 192.168.1.1 192.168.1.2 192.168.1.3 192.168.1.4 192.168.1.5 ... parameters.txt: portvalue username password session ... (2 Replies)
Discussion started by: gc_sw
2 Replies

5. Shell Programming and Scripting

Shell script that will compare two config files and produce 2 outputs 1)actual config file 2)report

Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated. script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made. OS :Susi linux ver 10.3. ... (4 Replies)
Discussion started by: muraliinfy04
4 Replies

6. Shell Programming and Scripting

simple join for multiple files and produce 3 outputs

sh script file1 filea fileb filec ................filez. >>output1 & output2 &output3 file1 z10 1873 1920 z_number1_E59 z10 2042 2090 z_number2_E59 Z22 2476 2560 z_number3_E59 Z22 2838 2915 z_number4_E59 z1 1873 1920 z_number1_E60 z1 ... (9 Replies)
Discussion started by: stateperl
9 Replies

7. Shell Programming and Scripting

awk to produce zip commands

Hi, I have a list of files which I want to rename and zipped up. The zip file will be split into small files when it contains 500 renamed file. Currently the way i am doing is like this. Get the filenames of the files in a list Generate another list containing the target filenames... (0 Replies)
Discussion started by: Leion
0 Replies

8. Shell Programming and Scripting

Perl Script to produce a file

hi i got a file called essay which contain few pages with many paragraphs. now i wanna with PERL to produce another file which called Essaylist that contain a sorted list of words that appear in the file essay. the format for Essaylist: $word found $times times on page a b c.... where $word... (3 Replies)
Discussion started by: mingming88
3 Replies

9. Shell Programming and Scripting

Adding things in a file and produce a new one

I wanna add a ":" at the end of each line, and i did something like this: cat Totals | while read ID TOTAL do echo "${ID}:${TOTAL}:" >>Totals2 done File: Totals 12345678:13 21443433:20 The outputs file Totals2 is: 12345678:13:: 21443433:20:: but i want 12345678:13:... (3 Replies)
Discussion started by: mingming88
3 Replies

10. Shell Programming and Scripting

awk NR==FNR compare 2 files produce a 3rd

hi, i have two files, both with 3 columns, the 3rd column has common values between the two files and i want to produce a 3rd file with 4 columns. file 1 a, ,b c file 2 a, b ,d I want to compare the 3rd value and if a match print to file 3 with the 3 columns from the first file... (11 Replies)
Discussion started by: borderblaster
11 Replies
Login or Register to Ask a Question