I want to remove all lines in a file which contain the word "test" but if that line contains "test@" then I do not want to delete it.

There is probably some funky way of doing this with sed but I am struggling, I tried to write a bash loop using sed but this is probably stupid.

```
filetest=/tmp/filetest
filetest_tmp=/tmp/filetest.tmp<
line_num=0

while read line; do
        line_num=$(($line_num+1))
        if [[ $line == *rootsh* ]] && [[ $line != *root@* ]]
                then
                sed -e "${line_num}"'d' $filetest >> $filetest_tmp
        fi
done < $filetest
cp $syslog_tmp $filetest

```

As you can tell, I'm a newb at this :(