Reference no: EM13347681
Write a /bash/bin program to perform a search of an employee list. The file emplist has the format given in the table below and contains information about an upcoming paintball game.
Columns
|
Data field
|
01 - 11
|
Department
|
12 - 26
|
Player name
|
27-39
|
Team Name
|
40- 54
|
Target
|
55-58
|
Status (full-time, retired, etc.)
|
Example of the " emplist " file... (The first two lines represent columns numbers, not in file)
0 1 2 3 4 5 6 7
1234567890123456789012345678901234567890123456789012345678901234567890
Marketing Ken Whillans Eagles Karen Thompson FULL
President Sandeep Jain Wimps Ken Whillans CONT
...
etc...
Program Requirements
- Continually prompt the user to enter a player's name or portion thereof (should not have to re-run program for each search). Use "ZZZ" to exit program.
- Ask the user if s/he wishes to see the corresponding target (T/t) or team name (M/m); reject any other input with an error message ("Please enter only T or M.") and re-prompt user.
- Search only the player field of the data file displaying the all occurrences of matching player(s) and corresponding target or team name.
- E.g. A search for the target of "Ken", should not display any information about "Sandeep". i.e. the search must be restricted to the information in the player column.
- Use the sample data file from the course website.
- If no player is found, your program should output a short message to the effect "No such player."
- If you create any temporary files, they must be cleaned up by your program before it terminates.
Sample execution (not exhaustive testing):
$ search
Player name? ohn
See target (T/t) or team name (M/m)? j
Please enter only T or M.
See target (T/t) or team name (M/m)? t
John Thompson Cher
John Jacobs Davinder Singh
Dean Johnson Sandeep Jain
Player name?..