TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using sed and evironmental variables
Is there a way to pass environmental variables into a sed script?
I have a env var called FOO=bob and the following sed script:
cat file | sed -e 's/FOO/$FOO/g'
I want to replace all occurances of "FOO" in file "file" with the value of the
environmental variable FOO, which has a value of bob.
Using the above sed script, all occurances of "FOO" are replaced by "$FOO",
not the bob (the value of $FOO).
Anyone?
--
Bob Tanner <tanner@real-time.com> | Phone : (612)943-8700
http://www.real-time.com | Fax : (612)943-8500
Key fingerprint = 6C E9 51 4F D5 3E 4C 66 62 A9 10 E5 35 85 39 D9