Search Character

Hi,

I need to search the "BP1418" in xml file(the letter BP remain constant but the number changes randomly and it will be in double quotes) . Can you please let me know how to find these charater in unix.

thanks

egrep '"BP[0-9]+"' file.xml will report the whole line it's on. If you want only the number:

egrep -o '"BP[0-9]+"' file.xml

Thanks for reply.. but i want to print that charater..

And that doesn't? It looks like it does to me.

$ echo 'stuff asdf <tag> <tag param="BP1418">' > file.xml
$ egrep -o '"BP[0-9]+'" file.xml
"BP1418"
$

If that's not what you wanted, please explain more clearly.