Grep a string from input file and delete next three lines including the line contains string in xml

Hi,

1_strings file contains

$ cat 1_strings
/home/$USER/Src
/home/Valid
/home/Review
$ cat myxml 
<projected value="some string" path="/home/$USER/Src">
<input 1/>
<estimate value/>
<somestring/>
</projected>
<few more lines >
<projected value="some string" path="/home/$USER/check">
<input 1/>
<estimate value/>
<somestring/>
</projected>
....
<few more>
<projected value="some string" path="/home/Valid">
<input 1/>
<estimate value/>
<somestring/>
</projected>
<few more>
<few more>
output: 
<few more lines >
<projected value="some string" path="/home/$USER/check">
 <input 1/>
 <estimate value/>
 <somestring/>
 </projected>
....
<few more>
<few more>

When i run grep -A3 i get the lines to be removed but i couldnt remove lines in xml file.
Appreciate your help.

Try grep -v -A3 infile > newfile .

With GNU sed you can try something like this (a sketch) :

while read line; do
  sed -i '/'"$line"'/,+4d' myxml
done <1_strings

Or you can try this approach:

awk ' -F\"
NR==FNR{a[$0]=$0;next}
/<projected value=/ && $(NF-1) in a {f=1}
/<\/projected>/ && f {f=0; next}
!f
' 1_strings myxml

hi,
How did i miss grep -v :eek:
i will test all the solutions to begin with.
Thanks to everyone.