problems using sed

i have a file acc.sh which has about 10 lines and then i have defined $var which has a line number in it (say 5). i want to extarct from line 5 to the end of the file and put the output into another file. I have used
sed -n $var,'$p' acc.sh | tee abc.sh
but at times it does'nt work and gives an error like
sed: -e expression #1, char 1: unknown command: `,'
can you help me with this.
thanks

 sed "$var,\$ p" acc.sh | tee abc.sh

escape the second $ character add a space before the p character.

doen't work.it copies the whole file

What OS and sed are you using? Works for me on HPUX 11.23 sed under /bin/ksh

if abc.sh is
192.168.1.41

then the output that i get is v5c01

my code is
sed 's/192.168.1.4/v5c0/g
s/192.168.1.41/acc1/g' abc.sh 2>&1 | tee abc.sh

i want to find 192.168.1.4 and replace it with v5c0
and find 192.168.1.41 and replace it with acc1

and i want to do it using sed

use > not |

sed "$var,\$ p" acc.sh > abc.sh

I though abc.sh was a shell script executing your output, my bad.

it works now thanks :slight_smile: ...can you please help me with the second problem as well