Print only values smaller than certain threshold in bash

Viewed 15659

I have a file with more than 10000 lines like this, mostly numbers and some strings;

-40

-50

stringA

100

20

-200

...

I would like to write a bash (or other) script that reading this file only outputs numbers (no strings) and only those values smaller than zero (or some other predefined number). How can this be done?

In this case the output (sorted) would be

-40

-50

-200

...

3 Answers
Related