Hi anybody help me in shell scripting

Hi .,

I want to grep a pattern in my file and want to replace it with a new one.

Here is the line where i need to modify

multimediaGroup type="media" dbid="525"

I want to replace the dbid value from 525 to 635 and how can i able to do it.

How can I write a script to read my file and grep the pattern 525 and get new input from me as 635 , then make it as modification .So finally I need that my file should have the entry as follows..

multimediaGroup type="media" dbid="635"

AnyBody well in scripting can help me..

Thanks & regards

Suseendran .A

[612 byte] By [susee_sun@yahoo.co.in] at [2007-11-26 10:32:09]
# 1
sed -e 's/multimediaGroup type="media" dbid="525"/multimediaGroup type="media" dbid="635"/' file >/tmp/tmpfile.$$mv /tmp/tmpfile.$$ file
robertcohen at 2007-7-7 2:39:47 > top of Java-index,Solaris Operating System,Solaris 10 Features...
# 2
Thanks a lot..It is working fine...
susee_sun@yahoocoin at 2007-7-7 2:39:47 > top of Java-index,Solaris Operating System,Solaris 10 Features...
# 3
Hi I had one more QueryIf i dont know my BID value & I want to grep it from the fileor If I want to replace the three digit BID valu e with the new one That I had..How it will be possible...
susee_sun@yahoocoin at 2007-7-7 2:39:47 > top of Java-index,Solaris Operating System,Solaris 10 Features...
# 4

If you want to replace any dbid

sed -e 's/multimediaGroup type="media" dbid="[0-9]*"/multimediaGroup type="media"dbid="635"/

Extracting the dbid is a little harder.

Assuming its on a line by itself

awk -F\" -e '/multimediaGroup/{print $4}'

works, but its an awful hack.

It works by looking for lines containing the string multimedia group then extracting the text between the 3rd and 4th double quotes "

robertcohen at 2007-7-7 2:39:47 > top of Java-index,Solaris Operating System,Solaris 10 Features...