Extracting a certain number with grep command

Hello Friends,

when I type grep '275' myfile.txt

it gives me all the lines including 275 but it also gives others such as 0.8827588 or 1127507.

I only want the lines including 275. How can I extract only 275 without other numbers including 275.

thanks

grep -w '275' myfile.txt

man grep

--ahamed

1 Like

use -w option for whole word search

 
grep -w 275 myfile.txt

check man page of grep for more details

1 Like