The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 07-01-2009
debbie15 debbie15 is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 2
how to expand environment variables in a file?

I am new to unix and would appreciate if someone could help.

I have an environment variable SourceFilePath=/db1/Src/test set on the unix server.

I want to expand this SHELL variable in a file using any command sed, awk etc

File contents is as follows:

var=$SourceFilePath/file.txt

The command should create a new file by subsituting the environment variable with the actual value.

The output should look like this.

var=/db1/Src/test/file.txt