Okay, I hope this is the right place to ask.  I have 2 files.The first file has 4 fields: class CRN #, Instructor ID #, Class Section #, Number of Students.  Example:0002  T00005  006  150004  T00004  012  26..etcThe second file has 6 fields (as best as I can tell):  Instructor ID #, First Name, Last Name, Building, Area Code, Phone Number.(not sure if first/last name is 1 or two fields...)Example:T00001  Larry Lastname  Corley  555  555-5555T00002  Ron  Lastname  Coreley  555  111-1111..etcThe question I'm supposed to answer is: how many sections did each instructor teach in a given semester?  The solution needs to be in the form of:# of sections | Instructor ID # | FirstName | LastName  (I just use the '|' for demonstration - The solution actually just uses spaces)So far, I have done this:$ cat sections/sem092 | sort -k 2 | awk '{ print $2 }' | uniq -c(sem092 is the first file I mentioned)And the output was so close to what I need.  From the above code I got:Num. of Sections Taught |  Instructor ID #Somehow, through pipes, I have to match the ID # with the names in the other file.  I have a very strong feeling I'm going to need to use grep.  I'm not looking for anyone to hold my hand.  I find this extremely interesting, but I think I've missed something along the way and need a nudge or two.
How to match a number in one file to a name in another file?
awk;grep;uniq
Save output of your command: cat sections/sem092 | sort -k 2 | awk '{ print $2 }' | uniq -c > firstPart.txtSave this line in file searchInstructorName.sh: cat $1 | while read line; do     instructorID=`echo $line | awk '{print $2}'`     name=`grep $instructorID instructorList | awk '{print $2   $4}'`    echo $line $name  doneThis script assume that firtsPart.txt line look like: 5 T00005and that instructorList is the name of file with 6 field.Finally try:bash searchInstructorName.sh firstPart.txtit should works.This is the version with a single script: cat $1 | sort -k 2 | awk '{ print $2 }' | uniq -c | while read line; do     instructorID=`echo $line | awk '{print $2}'`     name=`grep $instructorID $2 | awk '{print $2   $4}'`    echo $line $name  doneSave these lines in searchInstructorInfo.sh and run: bash searchInstructorInfo.sh sections/sem092 instructorList