+ Post New Thread
Results 1 to 7 of 7
Windows Thread, Search replace across multiple XML files in Technical; I need a utility that will replace all instances of certain text across a folder full of XML files (basically ...
  1. #1
    ajbritton's Avatar
    Join Date
    Jul 2005
    Location
    Wandsworth
    Posts
    1,641
    Thank Post
    23
    Thanked 75 Times in 45 Posts
    Rep Power
    29

    Search replace across multiple XML files

    I need a utility that will replace all instances of certain text across a folder full of XML files (basically text). I could knock up a script in an hour or two but there must be a utility out there? I've managed to get Agent Ransack to isolate the files using regular expressions but sadly it won't do replacements.

  2. #2
    Jona's Avatar
    Join Date
    May 2007
    Location
    Aberystwyth
    Posts
    438
    Thank Post
    9
    Thanked 44 Times in 43 Posts
    Rep Power
    17
    pspad - link will do a find replace in a directory of files but will be a dumb replace (e.g. doesn't have knowledge of the xml structure).

    Alternatively grep/sed/awk should be able to do it.

    Cheers
    Jona

  3. #3
    Heebeejeebee's Avatar
    Join Date
    Nov 2006
    Location
    Intergalactic Cruise
    Posts
    937
    Thank Post
    51
    Thanked 61 Times in 51 Posts
    Rep Power
    26
    ... also Crimson Editor

    HBJB

  4. #4

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    Brisbane, Australia
    Posts
    11,186
    Blog Entries
    3
    Thank Post
    537
    Thanked 924 Times in 835 Posts
    Rep Power
    196
    You can open XML files in dreamweaver. Open one document, setup find and replace, then configure is to do the same for the contents folder that document is stored and sub-folders. It will scan all the files and do the relevant stuff.

    Does that make sense? I hope this helps

  5. #5
    ajbritton's Avatar
    Join Date
    Jul 2005
    Location
    Wandsworth
    Posts
    1,641
    Thank Post
    23
    Thanked 75 Times in 45 Posts
    Rep Power
    29
    Thanks for the replies.

    In the end it turned out that only a handful of changes were required. I had a folder with about 100 XML files (all similar), but some of which had certain values that needed changing. I used Agent Ransack (my preferred search tool) to find the files with the offending value and then edited manually. Low tech but quicker in this case!

    If there are any Regular Expressions experts out there, can you tell me if it is possible to do the following;

    1 - Find a number in the following format; [0-9]*\.[0-9][0-9]
    2 - Round the value to nearest .5 (eg 0, 0.5, 1, 1.5 etc)
    3 - Inset the value back into the text

  6. #6
    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    10,963
    Blog Entries
    1
    Thank Post
    104
    Thanked 422 Times in 365 Posts
    Rep Power
    109
    Any language preference?

  7. #7
    ajbritton's Avatar
    Join Date
    Jul 2005
    Location
    Wandsworth
    Posts
    1,641
    Thank Post
    23
    Thanked 75 Times in 45 Posts
    Rep Power
    29
    Geoff - I suppose you are talking about a programming language, in which case, I would say VB or similar. I could probably code something if I had to, but it seemed like it should be possible with something like RegEx.

SHARE:
+ Post New Thread

Similar Threads

  1. Time to replace?
    By cgiuk in forum Hardware
    Replies: 11
    Last Post: 24th January 2008, 09:27 AM
  2. Search for files containing...
    By enjay in forum Windows Vista
    Replies: 4
    Last Post: 15th November 2007, 04:51 PM
  3. Restrict "Search files and folders"
    By sandfie in forum Windows
    Replies: 4
    Last Post: 26th March 2007, 11:45 PM
  4. To upgrade or replace
    By richard in forum General Chat
    Replies: 13
    Last Post: 13th March 2007, 01:54 PM
  5. Mass search and replace
    By Fletcher_Bravo in forum Windows
    Replies: 2
    Last Post: 5th July 2006, 04:44 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •