Using SED to delete some lines from file

Hi All,

I have one /etc/hosts.equiv file which has following entries

##########
wcars42g        admin
wcars42b        netmgr
wcars42b        oemssrvr
wcars42f        admin
wcars42f        netmgr
wcars42f        oemssrvr
##########

I am trying to delete lines starting from wcars42b. For this

i=`cat  -n /etc/hosts.equiv | grep wcars42b > counter ; cat counter  | grep  wcars42b | awk '{print $1}'`

If I do

#echo $i

then I get ouput as --> 2 3. So, I can conclude as , i is an array with two elements viz. 2 3

Now, If I try to use following command to delete the lines

sed ''$i','$i' d' /etc/hosts.equiv.test > /temp1

then I got error saying command not recognised. This is because first value provided to sed should be starting line number and second value should be ending line number.

Can anybody tell me, how should I provide 2 as starting line number and 3 as ending line number?

Not sure if I got it but basically:

grep -v ^wcars42b infile
#or
sed '/^wcars42b/d' infile

Shell variables can't be substituted inside ' and '. Use " and " instead for example. Or write it like

sed '/'${i}'/d' infile

Next time use

```text
 and 
```

tags when posting code, data or logs please.