Computing.Net > Forums > Solaris > Unix script for find and replace

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Unix script for find and replace

Reply to Message Icon

Name: krishsays
Date: January 19, 2005 at 13:25:30 Pacific
OS: Sun Solaris
CPU/Ram: sparc
Comment:

Hi

I need to write a unix script which does the following

---------
Properties file

Var1= XXXX
Var2= YYY
---------
-------------------------

File 1

Var1 = xxxx
Var2= yyyy

-----------------------
This script should search var1 and var2 in properties file and get those values and then search var1 and var2 in file1 and replace its value by the values achieved from first search. There are multiple file1.

Scenario is we want to change the values in properties file and then we want to run this script and it should reflect this in change other files( html files) .

Please can somebody help in this.

Thanks,
Krishan


thanks
Krishan



Sponsored Link
Ads by Google

Response Number 1
Name: mdhmi21
Date: January 22, 2005 at 12:00:13 Pacific
Reply:


This sounds like a homework question.

Mark


0

Response Number 2
Name: cdac1000
Date: January 27, 2005 at 03:34:02 Pacific
Reply:

well, what you could to is to source the properties file from within your script. In that case the modified variables are always available to you.

All you need to do is read them using $VARX sign.



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Solaris Forum Home


Sponsored links

Ads by Google


Results for: Unix script for find and replace

Need some help on Unix script www.computing.net/answers/solaris/need-some-help-on-unix-script/4408.html

Auto script for updating resolv.conf www.computing.net/answers/solaris/auto-script-for-updating-resolvconf/870.html

finding and copying files www.computing.net/answers/solaris/finding-and-copying-files/1444.html