Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I tried searching for this everywhere but couldn't find any solution. I have 100 html pages with various text to translate. I have also the translated text ready on a word document. So what I have to do is find multiple blocks of different text and replace them with multiple blocks of the translated text. I use normally dreamweaver which has a good find/replace function but it can only replace 1 block of text at a time. More specifically as an example, say i have 3 sentences (I personally have far more, something like 1000 different sentences to be replaced):

ENGLISH TEXT1, ENGLISH TEXT2 and ENGLISH TEXT3.

and want to replace all 3 of them respectively at once with:

SPANISH TEXT1, SPANISH TEXT2 and SPANISH TEXT3.

I need to find the "english blocks of text" wherever they may be in the html documents and replace them with the "spanish blocks of text" all at once without having to repeat the find/replace process thousands of times.

I am sure this is possible. I need a free utility for MAC or either someone to explain me exactly how i can achieve this in dreamweaver or elsewhere using Regular Expressions (which unfortunately I don't know anything about).

Thanks a lot in Advance.

share|improve this question
add comment

1 Answer

Few options here:

  1. OP's mention of DreamWeaver strikes me as being a tool-oriented user so check out a free text editor like Notepad++. It has has a "replace text in files" function which will do what you're looking for with multiple search-and-replace.
    • copy all files into a single root folder (it's OK to have files in subfolders, they should just all be under one root folder like /docs - /docs/folder1, /docs/folder2 is oK. You can have them in different places too, it will just require you to do this for each folder.
    • Install Notepad++, by searching from google or install from PortableApps (at portableapps.org)
    • under search, choose Find In Files and specify find/replace block.
  2. On Unix, use a tool like find piped to sed. If that's gibberish to you, consult with Dr. Google.
  3. Write a program. This is the long way 'round unless you're already comfortable with a language.
  4. Use something like google translate, again might be the long way 'round if you're not already a maven.

Based on what you said, I'd start with #1 and then go to #2 if that doesn't work out.

share|improve this answer
    
Sed is great, but you don't have to use a pipe with it. It can edit files in-place as easily. –  Zoredache Jul 6 '12 at 0:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.