Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

replacing a url in a file

Status
Not open for further replies.

dendenners

Programmer
Jul 17, 2001
110
IE
Hi there,
I deploy a web app to a unix box from a windows machine quite regularly. The app has a properties file that stores the location of static files. I want to use awk to find the property that holds this value, and change the value to the correct directory for the distributed application. i.e. in my (local) file I have the following property:

STATIC_FILE_LOCATION=
On the unix version I would like this to read

STATIC_FILE_LOCATION=
Would anyone know how I would effect such a change in an awk program so that I could integrate it into my build process? Thanks
 
awk -v old="dmccarthy" -v new=" -f url.awk url.txt

#--------------------- url.awk --------------------------

BEGIN {
FS=OFS="/"
}

/^STATIC_FILE_LOCATION/ {
if ($3 == old)
$3 = new;

print
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top