Loading ...
Sorry, an error occurred while loading the content.

My first question to the group . . .

Expand Messages
  • cosmyah
    ... is: How can I use a Find/Replace operation to insert a filename (or better, the first n characters of a filename) into that same file? That is, I want to
    Message 1 of 3 , Jun 27, 2011
    • 0 Attachment
      ... is:

      How can I use a Find/Replace operation to insert a filename (or better, the first n characters of a filename) into that same file?

      That is, I want to open a (html) file, go to a certain point, insert the file's name (or part of it) and then go on to the next file in that directory and do it all over again (using a new filename, of course). I have 600 files to process, and doing it manually is not feasible.

      I know how to do a "global" Find/Replace over all these files, but I need a token of some kind to insert the filename.

      Or a clip to do the same, operating over all 600 files.

      Can this be done?

      TIA, & cheers.
    • diodeom
      ... Sure. Please define any unique characteristics of this certain point that consistently apply to all files in your target directory. This could determine
      Message 2 of 3 , Jun 28, 2011
      • 0 Attachment
        "cosmyah" wrote:
        >
        > ... is:
        >
        > How can I use a Find/Replace operation to insert a filename (or better, the first n characters of a filename) into that same file?
        >
        > That is, I want to open a (html) file, go to a certain point, insert the file's name (or part of it) and then go on to the next file in that directory and do it all over again (using a new filename, of course). I have 600 files to process, and doing it manually is not feasible.
        >
        > I know how to do a "global" Find/Replace over all these files, but I need a token of some kind to insert the filename.
        >
        > Or a clip to do the same, operating over all 600 files.
        >
        > Can this be done?
        >

        Sure. Please define any unique characteristics of this "certain point" that consistently apply to all files in your target directory. This could determine whether there is a need to open each file in sequence prior to ^!Replace and ^!Save, or e.g. if ^$StrReplace()$ done on ^$GetFileText$ from each file followed by ^!TextToFile would suffice. Also, how are the file names structured and what part of them you'd like to capture?

        BTW, for cycling through a directory of files (capturing their names) check out (in Help on Clip Programming) the handy functions ^$GetFileFirst()$ + ^$GetFileNext()$ and/or $^$GetFiles()$.
      • Collier Smith
        Thanks for the swift reply, diodeom. You gave me some good leads on what to try. and if I hadn t studied regex a little more, and found a workable solution on
        Message 3 of 3 , Jul 1, 2011
        • 0 Attachment
          Thanks for the swift reply, diodeom.
          You gave me some good leads on what to try. and if I hadn't studied regex a
          little more, and found a workable solution on my own, I would sure try them.

          Next time I will be sure to show a more complete example of what I am trying
          to accomplish -- I can see how that would lead to an answer faster.

          Thanks again.
          -cosmyah


          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.