Delete lines falling in a range

Hi All,

I have a file which contains lakhs of records

0136812368126     03000   Statement
1237129372189     02321   JIT
0136812368126     05000   terminal
1237129372189     05001   Utilise

Is there an option to delete all lines which fall within the range 05000 to 05999?

I tried using simple grep to extract all matching lines but it's not working as expected

cat sample.txt | grep "05" > test

Please can you help?

grep -v -w 05[0-9][0-9][0-9] file

Are you looking to eliminate only those in secod column?

awk '{if (($2>=5000)&&($2<=5900)) {next} else print }'  filename

Equivalent command

awk '($2<5000)||($2>5900)' filename

No I want the entire line which contains the pattern 05000 to be deleted or put into a separate file. Also, these lines are not continuous meaning the lines containing 05000 upto 05999 are interspersed like in the below

0136812368126     03000   Statement
1237129372189     02321   JIT
0136812368126     05000   terminal
1237129372189     02999   Utilise
0136812368126     03000   Statement
1237129372189     05001   JIT
0136812368126     04253   terminal
1237129372189     05002   Utilise

All these lines containing the pattern from 05000 to 05999 should be separated out from the file

Did you try the awk solution I posted above?

The first option is working! Thanks