Originally Posted by emcykm
I'm new to the shell scripting. can any one help in creating shell script for matching the content of the specific variable with file. it should remove that line from the file if line is containing same value as variable and keep the other content as it is.
i used grep -v for accomplishing the same. But grep will remove the pattern which is similar.
For eg. Assume file "test" contain datas :
if i used grep -v command for the pattern "a" to this file this will remove content "aa" from the file.
I want the pattern only "a" should remove from the file, if it is existing. otherwise it should throw alert content not exists.
Ok...now we know what you WANT. Can you show us what you've DONE so far, to accomplish this? This sounds very much like homework, and as David the H. mentioned, reading the man pages will help you quite a bit. We'll be glad to help you, but we're not going to write your script for you.
Also, if it's not homework, does it have to be a shell script? Perl has some nice pattern-matching capabilities.....