PDA

View Full Version : help with bash scripting


caelestis
Jun14-09, 07:59 AM
Hello,

I was wondering if someone could help me with this question to let me know if i'm on the right track?

1. The problem statement, all variables and given/known data

We are given two files:
The first is a database file in the format of:
student-id [tab] lab-group [tab] Last-name, Other names
e.g u1234 [tab] tues9-11 [tab] Smith, John
u2345 [tab] wed9-11 [tab] Jones, Fred


The second is a log file in the format of:
student-id [tab] date of submission [tab] filename
e.g u1234 [tab] 15 June 2004 [tab] a2.jar


There is a single tab character between the variables.

It asks us to write a bash script that prints the list of names of students who have *not* submitted any files.

It also needs to take the names of both files as its two command line arguments.



3. The attempt at a solution

This is what i have at the moment:

#!/bin/bash

echo $1,$2

stuID=$(cat log.txt | cut -f1)
echo "$stuID" > submit

stuList=$(cat database.txt | cut -f1)
echo "$stuList" > late

grep -f submit late


Thankyou, I would kindly appreciate your help :)