find and replace using batch file programming

i am using windows server 2003.

I have a requirement that in a text file, i want to replace any word after keyword tablespace with some other word.

For example, if file contains the following line
create index csadidxqdes_1 on csadidxqdes(gvkeyx, qtr, datadate) tablesapce csxf_indexfundamentals;

then it should replace the word csxf_indexfundamentals with other word passed. Suppose it is basic in this example, then output should be

create index csadidxqdes_1 on csadidxqdes(gvkeyx, qtr, datadate) tablesapce basic;

Can any body please tell me, how can i do this using batch file programming.

Comments

  • : i am using windows server 2003.
    :
    : I have a requirement that in a text file, i want to replace any word
    : after keyword tablespace with some other word.
    :
    : For example, if file contains the following line
    : create index csadidxqdes_1 on csadidxqdes(gvkeyx, qtr, datadate)
    : tablesapce csxf_indexfundamentals;
    :
    : then it should replace the word csxf_indexfundamentals with other
    : word passed. Suppose it is basic in this example, then output should
    : be
    :
    : create index csadidxqdes_1 on csadidxqdes(gvkeyx, qtr, datadate)
    : tablesapce basic;
    :
    : Can any body please tell me, how can i do this using batch file
    : programming.
    :
    There is no batch command, which can edit text files. It is possible to write a real program (in C/C++, Delphi, etc.), which can perform a replace using the command line options. This can then be called from a batch file.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion