• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

Tricky Text File Find / Replace.

New Here ,
Apr 28, 2009 Apr 28, 2009

Copy link to clipboard

Copied

Please forgive me if this question is in the wrong place.

Part of the process i'm trying to accomplish is this:

- a text file has various pieces of text that need to be replaced

- what needs changed is in bold.

Example:

; Record 5509
@C ENDDOC# RI-P-00074674
@C PGCount  1
@T RI-P-00074674
@D @I\VOL002\RI007\IMAGES\018\
RI-P-00074674.tif

; Record 7882
@C ENDDOC# RI-P-00081423
@C PGCount  2
@T RI-P-00081422
@D @I\VOL002\RI007\IMAGES\025\
RI-P-00081422.tif
RI-P-00081423.tif

The path is what I'm trying to replace.   Occasionally, the path will increment from anywhere from 001 to 045.

The replacement string is @I\VOL001\package_images\ for all paths. 

Overall,

I feed it a file with the above data.

browses for the original location to grab a list of the directories (part of the path)

Attempting to loop thru the output of the text file to find any of the directory name occurrences and replace them with the final path.

Three attempts have not been so successful.

So far so good for:

- the text file that I feed it

- grabbing the directory names and building the list to loop with.

Not good so far:

- finding / repalcing the instances of the directory names in one pass.

- limiting the amount of time it takes to process

Any assistance would be greatly appreciative.

TOPICS
Advanced techniques

Views

363

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Apr 29, 2009 Apr 29, 2009

Copy link to clipboard

Copied

LATEST

Sounds like a good job for Regular Expressions.  You should be able to use sub-expressions to match on your 001-045.  Check out ReReplaceNoCase() - I think it will accomplish what you are trying to do.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation