mirror of
https://github.com/caperren/school_archives.git
synced 2025-11-09 21:51:15 +00:00
Added work from my other class repositories before deletion
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
stats {-rows|-cols} [input_file]
|
||||
|
||||
DONE: Numbers are separated by tabs, lines by newlines
|
||||
|
||||
DONE: Check for the correct number of arguments, failure to standard error
|
||||
|
||||
DONE: Check whether file is readable, or exists, stderr if not
|
||||
|
||||
DONE: -rows and -cols should work for anything that starts with its character eg. -rad would do rows
|
||||
|
||||
Stats output to stdout
|
||||
|
||||
Exit value for errors should be 1
|
||||
|
||||
You can assume each row will be less than 1000 bytes long, unix limits this, but unlimited numbers of rows
|
||||
|
||||
DONE: If using temp files, make sure they include process id's in name to allow for simultaneous runs. Remove files when done.
|
||||
|
||||
DONE: Use the trap command to catch interrupt, hangup, and terminate signals to remove temp files if terminates unexpectedly
|
||||
|
||||
Values and results must be whole numbers, round like normal, 7.5 to 8, 7.4 to 7
|
||||
|
||||
DONE: Calculations must be done with expr or commandline tools. No other languages
|
||||
|
||||
DONE: For median, sort values and take the middle value. If even, take the larger of the middle two values.
|
||||
|
||||
DONE: Must be in a single file.
|
||||
|
||||
DONE: You can return an error if there is no input file
|
||||
|
||||
HINTS
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
% cat test_file
|
||||
1 1 1 1 1
|
||||
9 3 4 5 5
|
||||
6 7 8 9 7
|
||||
3 6 8 9 1
|
||||
3 4 2 1 4
|
||||
6 4 4 7 7
|
||||
% stats -rows test_file
|
||||
Average Median
|
||||
1 1
|
||||
5 5
|
||||
7 7
|
||||
5 6
|
||||
3 3
|
||||
6 6
|
||||
% cat test_file | stats –c
|
||||
Averages:
|
||||
5 4 5 5 4
|
||||
Medians:
|
||||
6 4 4 7 5
|
||||
% echo $?
|
||||
0
|
||||
% stats
|
||||
Usage: stats {-rows|-cols} [file]
|
||||
% stats -r test_file nya-nya-nya
|
||||
Usage: stats {-rows|-cols} [file]
|
||||
% stats -both test_file
|
||||
Usage: stats {-rows|-cols} [file]
|
||||
% chmod -r test_file
|
||||
% stats -columns test_file
|
||||
stats: cannot read test_file
|
||||
% stats -columns no_such_file
|
||||
stats: cannot read no_such_file
|
||||
% echo $?
|
||||
1
|
||||
Reference in New Issue
Block a user