T. Dmitry T. Dmitry - 2 months ago 13
Linux Question

ubuntu terminal: grep for numbers compare

I have text file with table

|ID | NAME | CREDIT|
and content

Is it real to get all lines, where
CREDIT < 1337
(for example) by
grep
?

Have no idea, tnx

Answer

You can do it with pure grep, but it's ugly. Here you are:

grep -e " .$" -e " ..$" -e " ...$" -e " 1[0-2]..$" -e " 13[0-2].$" -e " 133[0-6]$"