The Question is like Find those names who have got number greater than equal to m but less than n. A ".csv" file is given. It is preferable to solve this using grep (regex) .
I am going like this:
cat abc.csv|cut -f 3,7 -d ","|grep "4[4-9][0-9]*"|head
But it is giving me other than desired
NOTE column 3 is person's name and column 7 is the corresponding number of those people.
Any suggestion to solve this will be very helpful.
Try:
cut -d, -f 3,7 Bulk.csv | grep ',4[0-9][0-9][^0-9]' | cut -d, -f 1
Explanation: cat
is not necessary. The expression [^0-9]
means everything except a digit; using only ,4[0-9][0-9]
as regex would select also lines containing numbers with more digits before the decimal point, like 4247.14
, which is not what you want.
We miss a sample of your input file Bulk.csv
to reproduce your problem.