Replace text in a folder

Discussion in 'Computer Support' started by Chaudhry Nijjhar, Oct 10, 2007.

  1. Hi,

    I have web sites in a folder and want to replace my web site address from

    www.nijjhar.freeserve.co.uk

    to

    homepage.ntlworld.com/rajinder.nijjhar

    Is there an easier way than retyping the above two texts after opening each
    page's source text?

    Rajinder
     
    Chaudhry Nijjhar, Oct 10, 2007
    #1
    1. Advertisements

  2. Chaudhry Nijjhar

    Evan Platt Guest

    Not that I'm aware of.

    Opening the document in Wordpad, and using Find / Replace will work
    fine though.

    While you're fixing it, start using relative instead of absolute
    URL's.

    What does this mean?

    If you have www.somedomain.com , and you have a link to say
    www.somedomain.com/link1 and www.somedomain.com/link2 , you can
    instead have the links be /link1 and /link2. That way if you ever
    change domains, you don't need to do anything.
     
    Evan Platt, Oct 10, 2007
    #2
    1. Advertisements

  3. If you were on *nix, you could do something like this: (untested but should work)

    mkdir temp
    for page in $(ls -ltr | awk '{print $NF}')
    do
    cat $page | sed 's*www.nijjhar.freeserve.co.uk*homepage.ntlworld.com/rajinder.nijjhar*g' > temp/${page}
    done

    This basically takes all the files in the current directory, changes www.nijjhar.freeserve.co.uk
    to homepage.ntlworld.com/rajinder.nijjhar and dumps them in the temp directory with the same
    name. The default delimiter of the sed command is '/' but since you have a / in your result string
    we have to override it. I chose a '*' but pretty much any special character will work as long
    as it's not in one of the strings you are changing from or to.

    Then all you'd have to do would be

    cp ./temp/* .

    and your pages should be copied back up to the current directory.
    Note: This should also work if you have cywin or MS SFU installed,
    but I don't claim to have tested it.
     
    Pseudo Silk Kimono, Oct 10, 2007
    #3
  4. Thanks. There does not seem to be a simple solution as I thought.

    Rajinder
     
    Chaudhry Nijjhar, Oct 11, 2007
    #4
  5. Are you using Windows?
    http://www.topshareware.com/SCR-download-11177.htm
    http://www.programurl.com/cian-text-replacer.htm

    A google search for windows text replacement tool

    http://www.google.ca/search?hl=en&q=windows+text+replacement+tool&btnG=Google+Search&meta=
     
    Pseudo Silk Kimono, Oct 11, 2007
    #5
  6. Chaudhry Nijjhar

    thanatoid Guest

    This will only work if the files either ARE in .txt format or
    are converted to that format first [it actually MIGHT work in
    ANY format, since your *text* is still just text, regardless of
    proprietary word-processing format, but I'm not 100%sure), but
    if you DL NoteTab Light from http://www.notetab.com/ntl.php,
    freeware, you can open a whole bunch of files (limited only by
    RAM I think, I've opened up to 40 or so) at the same time and
    the "replace" box has an "all documents" option, so with a few
    clicks you can make all the changes in >I think< as many
    documents as your RAM will handle.

    *Generally* it is best to store all your test files in txt
    format anyway, and only make them doc's or pm7's or whatever
    when "using" them.
     
    thanatoid, Oct 11, 2007
    #6
  7. Chaudhry Nijjhar

    why? Guest

    On Wed, 10 Oct 2007 18:49:19 GMT, Chaudhry Nijjhar wrote:

    This time read what you are told and do some looking around for other
    sites if you don't follow the guides you are pointed at.

    Also remember to backup your site and check the backup worked before
    making changes, maybe even 2 backups.
    Allow advertising for a commercial travel agent?
    NTL/VM won't for homeuse, you need a commercial account

    These links need fixed

    'back to Top'

    pointing to files on your PC is silly

    file:///C:/Website/index.htm#top
    Many / several programmer's text editors have a Replace Text in File
    feature.

    I like Ultraedit-32 www.ultraedit.com it's not free but well worth the
    money.

    Check the features of other editors, from somewhere like the tucows
    shareware / freeware site
    http://www.tucows.com/
    look for
    Development & Web Authoring / Text editors

    I hever used these,

    http://www.editpadpro.com/convenience.html
    EditPad Pro sports one of the most extensive search-and-replace features
    of any text editor. Quickly find the part of the file you want to edit.
    Highlight matches, fold lines, and skip over matches and files.
    Instantly make many replacements throughout a (rectangular) selection,
    file.


    http://www.massfileeditor.com/
    Powerful text operations engine to process large number of files
    routinely.
    Automatically edits any number of files chosen by a user-supplied list,
    searches the plain text or regular expressions,


    If you don;t like any of those also search
    http://www.download.com/
    or
    http://www.snapfiles.com/


    Another 1
    http://www.boxersoftware.com/pgfeat.htm
    Find Text in Disk Files
    * search across one drive or all drives
    * search subdirectories, or restrict search by file attributes


    The other method is of course not to put

    www.nijjhar.freeserve.co.uk
    or
    homepage.ntlworld.com/rajinder.nijjhar

    As part of any link, you use relative URLs and not absolute URLs.
    http://www.w3.org/TR/WD-html40-970708/htmlweb.html
    http://www.webdevelopersnotes.com/design/relative_and_absolute_urls.php3
    http://www.iusmentis.com/technology/www/relativeurls/
    http://www.ibdhost.com/help/path/

    With relative URLs you can move the site 'pages' to / from any ISP /
    hosting company.

    Me
     
    why?, Oct 11, 2007
    #7
  8. Chaudhry Nijjhar

    Guest

    Hello,

    You can try "Replace Pioneer", a newly released software in Oct, 2007,
    it's pretty easy to finish your above tasks.
    Further more, it will give you many surprise.

    You can download it at http://www.mind-pioneer.com

    The "Four Greate Invention" of Replace Pioneer:
    1) Find text much more accurate:
    Support maximum 7 level filters in pattern match:
    * Paragraph pattern filter: user can select only desired paragraph by
    pattern matching.
    * Paragraph range filter: among the matched paragraphs, user can
    select a range to replace.
    * Line pattern filter: user can select only desired line by pattern
    matching.
    * Line range filter: among the matched lines, user can select a range
    to replace.
    * Pattern filter: user can find final replace items by this pattern
    matching.
    * Range filter: among the matched items, user still can select a
    range to replace.
    * Condition filter: the additional powerful condition filter is to
    remove unwanted result, make replace more accurate.

    2) Replace text much more flexible:
    Support user-defined transformation of replace text instead of fixed
    text. The software can replace the found text with any self-defined
    conversion, which make it easier to support flexible context-related
    replacement. A lot of variables and functions are provided to support
    the conversion.

    3) File input/output much more powerful:
    Support file spliting and merging in horizontal and vertical
    direction.
    Support Web Page and DOS command result as input file type.
    Support UNICODE and Most of the other Encoding types.
    4) Operation much more easier and reliable:

    Recording and re-running scheme make replace and script creating work
    much more easier, and detail recorded and highlighted change make
    software much more reliable.
     
    , Oct 23, 2007
    #8
  9. Chaudhry Nijjhar

    why? Guest

    On Tue, 23 Oct 2007 06:07:01 -0000, wrote:

    Why tell me?

    Learn how to reply to the OP or use piggyback, snip , not bottom posting
    away from the OP's question doesn't help either.
    <snip>

    Me
     
    why?, Oct 23, 2007
    #9
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.