Timeline for Is there a way to get the min, max, median, and average of a list of numbers in a single command?
Current License: CC BY-SA 3.0
15 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 11, 2015 at 8:03 | comment | added | G-Man Says 'Reinstate Monica' | (Cont’d) … BTW, it’s debatable whether this would yield a better answer. We try to minimize the number of processes (commands), but the merged awk script would be more complex and harder to understand, which we try to avoid. | |
| Oct 11, 2015 at 8:03 | comment | added | G-Man Says 'Reinstate Monica' | Learning how to shuffle things around to get the same results can be tricky; I’m glad to help in your education. And as I said, it’s a good first effort. Do you want a challenge to try to learn some more? Your answer currently consists of two awks and one sort. It is possible to rearrange the pieces so you can do the same job using one awk and a sort (and no other commands). A trivial hint: you would have to merge the two awk scripts into one. Can you figure out how to do it? … (Cont’d) | |
| Oct 11, 2015 at 4:41 | comment | added | Rahul Agarwal | Hey thanks for removing the third cat. This was my first awk script. And I feel that I learned a lot from this exercise and you. For example I also learned the use of ;(synchronous commands) .........:) | |
| Oct 11, 2015 at 4:33 | history | edited | Rahul Agarwal | CC BY-SA 3.0 | added 1 character in body |
| Oct 10, 2015 at 17:10 | comment | added | G-Man Says 'Reinstate Monica' | Good. I eliminated the third cat and added to the explanation. | |
| Oct 10, 2015 at 17:09 | history | edited | G-Man Says 'Reinstate Monica' | CC BY-SA 3.0 | Simplified code; added explanation. |
| Oct 10, 2015 at 15:40 | comment | added | Rahul Agarwal | Made edits as per suggestions. Didn,t knew about the overhead of cat command. Always used it to stream single files. Thanks for telling me about UUOC..... | |
| Oct 10, 2015 at 15:39 | history | edited | Rahul Agarwal | CC BY-SA 3.0 | added 4 characters in body |
| Oct 10, 2015 at 15:31 | history | edited | Rahul Agarwal | CC BY-SA 3.0 | added 328 characters in body |
| Oct 10, 2015 at 6:20 | comment | added | G-Man Says 'Reinstate Monica' | (Cont’d) … (3) Your code is safe, since you set FILENAME and you know what you set it to, but, in general, you should always quote shell variables unless you have a good reason not to, and you’re sure you know what you’re doing. (4) Both your answer and Bruce’s ignore negative input (i.e., numbers beginning with -); there is nothing in the question to suggest that this is correct or desired behavior. Don’t feel bad; it’s been over four years, and, apparently, I’m the first person who noticed. | |
| Oct 10, 2015 at 6:19 | comment | added | G-Man Says 'Reinstate Monica' | (Cont’d) … Please do not respond in comments; edit your answer to make it clearer and more complete. (2) Fixing the script so that it does not need to hold the entire array in memory is a good improvement, but I’m not sure whether it’s appropriate to say that your version is “more efficient” when you have three unnecessary cat commands; see UUOC. … (Cont’d) | |
| Oct 10, 2015 at 6:18 | comment | added | G-Man Says 'Reinstate Monica' | Welcome to Unix & Linux! Good job for a first post. (1) While this may answer the question, it would be a better answer if you could explain how/why it does so. The site’s standards have evolved over the past four years; while code-only answers were acceptable in 2011, we now prefer comprehensive answers that provide more explanation and context. I’m not asking you to explain the entire script; just the parts that you changed (but if you want to explain the entire script, that’s OK too). (BTW, I understand it fine; I’m asking on behalf of our less experienced users.) … (Cont’d) | |
| Oct 10, 2015 at 2:03 | review | Late answers | |||
| Oct 10, 2015 at 4:11 | |||||
| Oct 10, 2015 at 1:49 | review | First posts | |||
| Oct 10, 2015 at 2:20 | |||||
| Oct 10, 2015 at 1:44 | history | answered | Rahul Agarwal | CC BY-SA 3.0 |