global search and replace tool

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tandem person

    global search and replace tool

    I am in search of a free tool which can replace multiple strings on
    the particular directory . Please let me know if any such , written in
    perl.


    Thanks
    Athresh
  • Jürgen Exner

    #2
    Re: global search and replace tool

    Tandem person wrote:[color=blue]
    > I am in search of a free tool which can replace multiple strings on
    > the particular directory . Please let me know if any such , written in
    > perl.[/color]

    I think you will have to explain a bit more what you are talking about.
    Directories (at least in the typical standard operating systems) are mere
    lists of files (in the broadest meaning) and
    at least I can't see where strings and directories have anything to do with
    each other.

    jue


    Comment

    • Tandem person

      #3
      Re: global search and replace tool

      Hi specification is as below.

      I have few function calls that has to be changed to the new one in the
      whole source files ,present in a single directory. Please let me know
      if any such tools available.
      "Jürgen Exner" <jurgenex@hotma il.com> wrote in message news:<eUxlb.524 51$mp1.44609@nw rddc02.gnilink. net>...[color=blue]
      > Tandem person wrote:[color=green]
      > > I am in search of a free tool which can replace multiple strings on
      > > the particular directory . Please let me know if any such , written in
      > > perl.[/color]
      >
      > I think you will have to explain a bit more what you are talking about.
      > Directories (at least in the typical standard operating systems) are mere
      > lists of files (in the broadest meaning) and
      > at least I can't see where strings and directories have anything to do with
      > each other.
      >
      > jue[/color]

      Comment

      • Donald 'Paddy' McCarthy

        #4
        Re: global search and replace tool



        Tandem person wrote:[color=blue]
        > Hi specification is as below.
        >
        > I have few function calls that has to be changed to the new one in the
        > whole source files ,present in a single directory. Please let me know
        > if any such tools available.
        > "Jürgen Exner" <jurgenex@hotma il.com> wrote in message news:<eUxlb.524 51$mp1.44609@nw rddc02.gnilink. net>...
        >[color=green]
        >>Tandem person wrote:
        >>[color=darkred]
        >>>I am in search of a free tool which can replace multiple strings on
        >>>the particular directory . Please let me know if any such , written in
        >>>perl.[/color]
        >>
        >>I think you will have to explain a bit more what you are talking about.
        >>Directories (at least in the typical standard operating systems) are mere
        >>lists of files (in the broadest meaning) and
        >>at least I can't see where strings and directories have anything to do with
        >>each other.
        >>
        >>jue[/color][/color]

        perl -p -i -e 's/Oldname/Newname/' /pathToDir/*

        Comment

        • Jürgen Exner

          #5
          Re: global search and replace tool

          Tandem person wrote:[color=blue]
          > I have few function calls that has to be changed to the new one in the
          > whole source files ,present in a single directory. Please let me know
          > if any such tools available.[/color]

          In general you will need a fully-fledged parser for your particular
          programming language in order to parse the source code of that programming
          language. Otherwise you are running the risk that in addition to the desired
          function calls other text pieces may be changed, too, if they happen to have
          or contain the same character sequence (e.g. in a string or as part of the
          name of some other function) .

          If you think in your particular situation you can accept that risk then
          please have a look at
          - "perldoc -f glob" or "perldoc -f readdir" about how to get the names
          of all files in a directory
          - "perldoc perlop" for information about the "s" operator
          ("substitute "); maybe "perldoc perlre" for information about regular
          expressions
          - and "perldoc -q change" for the FAQ entry about "How do I change one
          line in a file[...]?"

          jue


          Comment

          Working...