Hi all,
I want to do a very simple thing with sed. I want to print out the line number of a disk I have defined in /etc/exports, so I do:
It's all good, but here's the problem. When I define md0 in a variable, I get nothing from sed:
Why is that? can anybody please help?
Thanks
joeyg
2
> cat file9
/usr/bin/bash
/usr/bin/ksh
/usr/bin/me
/mdo/here/there
/jkl/lost/not
> dev=mdo
> echo $dev
mdo
> sed -n '/mdo/=' file9
4
> sed -n "/mdo/=" file9
4
> sed -n "/"$dev"/=" file9
4
Variables are not expanded inside single quotes; use double quotes:
sed -n "/$dev/=" /etc/exports