Grep File Full Path in a file

Hi,

I would like to know how to grep all the paths in a file having extension .BMP

For e.g.
File Name :
sample.txt
File Content :

xxxxxxxxxxxxxxxxx
xxxxx/root/cdrive/picure.BMP xxxx
xxxxxxxxxxx
xxxxx/root/ddrive/picure.BMP xxxx
xxxxxxxxxxx

Expected Output :

/root/cdrive/picure.BMP
/root/ddrive/picure.BMP

Operating System :
Linux x86_64 x86_64 x86_64 GNU/Linux

Any Suggestion ?

Thank you

[user@host ~]$ cat file
xxxxxxxxxxxxxxxxx
xxxxx/root/cdrive/picure.BMP xxxx
xxxxxxxxxxx
xxxxx/root/ddrive/picure.BMP xxxx
xxxxxxxxxxx
[user@host ~]$ grep -o '/.*\.BMP' file
/root/cdrive/picure.BMP
/root/ddrive/picure.BMP
[user@host ~]$

Mentioning grep you seem to have an idea on how to approach the problem. What did you try so far?

And, how sure are you that the strings before /root/... can be safely discarded, i.e. that we are talking of an absolute path starting at /root ?

For me

grep -o '/.*\.BMP' file 

is retrieving

xxxxx/root/cdrive/picure.BMP xxxx
xxxxx/root/ddrive/picure.BMP xxxx

but i want

/root/cdrive/picure.BMP
/root/ddrive/picure.BMP

Please suggest.

Thanks

No, it doesn't. Look at this transscript:

~ $ echo 'xxxxx/root/cdrive/picure.BMP xxxx'|grep -o '/.*\.BMP'
/root/cdrive/picure.BMP
~ $

Works like advertised....