0

I need to choose from output only lines where number is bigger than chosen number.

For example x=27 and I need to find only lines where the number in first column is bigger than that x. In this case: only third and fourth line and first and second would be thrown away.

25 text
26 text
30 text
35 text

Output would look like this:

30 text
35 text

1 Answer 1

3

You can pipe output via following script

| while read a b ; do [ $a -gt 27 ] && echo "$a $b" ; done

or

| while read ; do [ ${REPLY% *} -gt 27 ] && echo "$REPLY" ; done

but easyest through awk

| awk '$1 > 27'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .