-1

I'm trying to do a count of all the values (numeric) in the third column of a file that fall within a specific range of numbers. I've found the min and max but have no idea how to do the count now. I've tried egrep, grep, awk, and more but am still confused. I'm very new to UNIX/Bash and would really appreciate any help. Thanks so much!

  • 2
    It will be better if you edit your question with sample input file and required output, so someone could help you. Now is unclear what you are trying to achieve. – taliezin Jun 5 '15 at 7:14
1

I interpret your question that you want to sum up only those numbers in column 3 that are within some numeric range. Try (for sample range [9-12]):

awk '$3>=9 && $3<=12 {s+=$3} END {print s+0}' the_file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.