December 1999
Beginner
528 pages
11h 10m
English
The user can either view all records or just a particular record. If the user wants to see all records then a simple cat and awk statement does it. If the records contain many fields then a more user-friendly output would be required, but this will suffice for our needs.
if [ "$STR" = "all" ]; then
echo "Surname Name Employee Code"
echo "_______________________________"
cat $DBFILE |awk -F: '{print $2"\t"$3"\t\t"$1}' | more
return 0
fi
The code to display a single record has already been covered in deletion and amendments. One slight change is the ability to print a record when the user chooses this option. Here’s the piece of code that sends a record to the printer:
pr <<- MAYDAY RECORD No : $REC EMPLOYEE NUMBER : $CODE ...Read now
Unlock full access