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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

replacing text within an oracle sql file

Status
Not open for further replies.

froghead

Programmer
Jun 9, 2006
1
GB

I have a set of oracle sql files, each with an insert and delete statement as follows:

delete from t_schema_version where version = '1.41'
/
insert into t_schema_version (version, RELEASE_DATE, BUILD_DATE,COMMENTS,APPLIED_BY)
values ('1.41', sysdate, sysdate, 'Patch 41', 'pk')
/
commit
/

I wish to replace each occurence of 41 with whatever number I supply as a parameter. The questions I have are:
1. Is this possible from the command line?
2. Can I do this with awk or can I use "vi"?

thanks in advance

 
1. Yes

2. sed is the most appropriate tool for this.

sed 's/41/42/g' originalfile > newfile for example.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top