Using a variable in sed command

Hi All,

Can I use a variable (using this variable as a counter) in sed cmd?

something like below
sed -n '${COUNT}p'

But it's not working. Pls help.

Thanks.

Regards,
Amee

export COUNT=1
export COUNTER=`cat ${BINPATH}/$ALLOC_FILE.clean_1 | wc -l | tr -d " "`
while [ ${COUNTER} -gt 0 ]
do
cat ${BINPATH}/$ALLOC_FILE.clean_1 | sed -n '${COUNT}p' > $HOME/leg_1.out
-- some code --
--
--
COUNTER=`expr $COUNTER - 1`
done
cat ${BINPATH}/$ALLOC_FILE.clean_1 | sed -n "${COUNT}p" > $HOME/leg_1.out

hey mate! Thanks it worked!

Single quotes block variable expansion. Double quotes permit variable expansion.