LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] substituting shell variables with sed

[ILUG] substituting shell variables with sed

Conor Daly conor.daly at oceanfree.net
Sun Mar 25 02:57:14 IST 2001


It's probably a FAQ but how do I substitues a shell variable with sed?  I
have the following:

PATH_MPAGE=`which mpage`

and then later:

cat ./dprint | sed -e 's at mpage@\$PATH_MPAGE@' > dprint.out

but grep -i mpage dprint.out gives the following:

$PATH_MPAGE -$PAGES_UP -a -X -m10l0t50b40r -r -j 1%2 -P$PRINTER $FILE
$PATH_MPAGE -$PAGES_UP -a -X -m20l-10t50b40r -j 2%2 -P$PRINTER $FILE

where I want 

/usr/bin/mpage -$PAGES_UP -a -X -m10l0t50b40r -r -j 1%2 -P$PRINTER $FILE
/usr/bin/mpage -$PAGES_UP -a -X -m20l-10t50b40r -j 2%2 -P$PRINTER $FILE

or whatever the output of `which mpage` is.  I tried stuff like 

sed -e 's at mpage@\${PATH_MPAGE}@'  and

sed -e 's at mpage@"$PATH_MPAGE"@'

but keep getting "$PATH_MPAGE" in the output.  Any thoughts?

TIA

-
Conor Daly <conor.daly at oceanfree.net>

Domestic Sysadmin :-)
---------------------
Faenor.cod.ie
  3:50am  up 25 days, 13:24,  0 users,  load average: 0.00, 0.00, 0.00

Hobbiton.cod.ie
  2:59am  up 25 days, 12:09,  1 user,  load average: 0.00, 0.00, 0.00




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell