SR Win Tutorial

A guide to batch search and replace

Written by Tom from Tom's Newbie Booster

You might think that this short guide will not apply to you but I can promise you that, if you're an adult webmaster, it will! Knowing how to batch search and replace is an absolute godsend at times can save you literally hours of tedious and boring work.

What does 'batch search and replace' mean?


Let's imagine you've created a webpage, and that webpage has an advert on it for a porn site. You later find out that link in that advert goes to the wrong Paysite. Oops! Now it's not going to take long to start up your webpage software and to correct your mistake on one page. But what if you have fifty webpages which all have the same mistake on them? What about if those 50 webpages are scattered into different folders and different sites?

Now we've got a very time consuming job on our hands. Even remembering and finding the pages which had the mistake on them could be an almost impossible exercise. So why not use a bit of software which will do it all for you?

Enter SR Win


SR Win is one of many tools which have been invented to do the job of what we call batch searching and replacing. SR Win is like a sniffer dog - you tell it what you want to find, what you want to replace it with, and then let it loose. It then tears through files and folders and, upon finding something you've told it to look out for, will replace that with what you've told it to.

Sr Win is also FREE! Wahoo - the best price there is.

Let's see the process in action


It's time for me to stop blathering here - let's test this thing out. This will give you the best idea of what batch searching and replacing is all about.

1) Grab the software - download SR Win and install it.
http://www.topniche.com/newbie-booster/resources/sr-win.zip

2) Now let's get some files to play around with. Download this file:
http://www.topniche.com/newbie-booster/resources/sr-win-tutorial/download1.zip

3) Create a temporary folder on your hard disk somewhere (with nothing else in it) and unzip the 10 html files contained in download1.zip into it.

4) You should now have something which looks like this:
http://www.topniche.com/newbie-booster/resources/sr-win-tutorial/before/

Take a look at the HTML files we've now got. There should be 10 files like this one:

http://www.topniche.com/newbie-booster/resources/sr-win-tutorial/before/file1.html

...which all say the same thing:

"Just a quick hello "

5) Start the SR Win software.

6) The first thing we need to do is to tell SR Win which directory on our hard disk it should start searching for files in. Go down to where it says 'Starting Directory', and click the square with the three dots in it ". . .". Choose the directory on your hard disk where you unzipped the files to. The path to this folder should now appear in that box.

SR Win can search through sub-folders too. If you were to start it in c:/ on your hard disk, for example, it would search through EVERY single file and folder on your hard disk. It starts in the folder you give it and works down from there. So if you put something like c:/pictures/ in the box we've just filled, SR Win would NOT search every file on the hard disk. It would only search and replace on every file in /pictures/ only, and all the sub-folders in that folder. And all the sub folders in those sub folders... and so on.

7) Next up we need to tell the software what it should look for in the files it's going to hunt through. This has to be TEXT. Always text. It can be a very long bit of text - a huge money bar, or text ad, but it has to be text. In this tutorial, we're going to give it something really simple to work through. In the box to the right of "Find:" type "hello" - all lower case. Without the " " marks around it. This is the text that will be searched and replaced.

8) Now click in the white box to the right of "Replace:". This is the place where you put the text that will replace whatever is put in the 'Find:' box. In this case, put the following text: "goodbye by friend". Like the replace box, you can have text that reaches far beyond the length of this box as it appears on the screen. It could be a few words or much more.

9) Now go down to the "File Type" box. This is where we tell SR Win which kinds of files it should open up, look for the "find" text, and replace with the "replace" text. There are a number of choices here. You could put:

*.htm
*.html
*.shtml
*.txt


The star, to the computer, means "anything". So by putting *.html in this box, it's the same as saying, "computer, look through ALL html files!".

in this box, but let's make it really easy. You'll only ever have to set this ONCE. Put the following in the box:

*.*

This means that SR win will look through ALL files on the hard disk. This is useful because you might have .htm AND .html files that contain the text you'd like to replace.

10) Check the "Make Backups" box for now (CHECK means put a tick in it - make sure it's selected...). I don't normally use this but if it goes wrong I'll be sorry some day lol! Making backups means that all files that are searched and have a replace done on them will have a back-up made which you can get your old page back with. If you search through a lot of files, this will generate a LOT of backups. As you get more confident, turn off the feature to make back-ups.

11) CHECK the box which says "Include Sub-directories". There will be times when you'll want to turn that on or off. So just remember to consider it for each search and replace you do. If you want to go through ALL of your html files, in every sub-folder then you'll need to check this box.

12) Make sure the following settings are set:

- Read only files: Process checked.

- Regular expression search - not selected.

- Case sensitive search - not selected.

- Save settings on exit - SELECTED.

- Record a log file - SELECTED.

- Enable HTML File processing - not selected.

13) Final check before BLAST OFF! Make sure your screen looks something like this:



14) Then press Start.

Boom! You'll see the files being processed in the panel on the right of SR Win. The speed it pretty mind blowing. While it would probably take us a while to open up those files, SR Win does it in seconds. This is a very powerful little tool.

If all went well, your files should ALL look like this:

http://www.topniche.com/newbie-booster/resources/sr-win-tutorial/after/file1.html

"Just a quick hello "

SHOULD NOW READ:

"Just a quick goodbye by friend "



Repeat the tutorial if you didn't get these results and please let me know if you need more help.

What about my on-line files?


You might be wondering what all of this has to do with your business. After all, SR Win did all of the searching and replacing on your hard disk. And in reality - SR Win never does, and is not capable of a search on your webspace. But let's remember the golden rule of your online business. Your hard disk should contain an EXACT version of what's on your webspace. And you should never upload ANYTHING which is not uploaded from the exact same place on your hard disk.

Now this starts to make sense. If SR Win does a batch search and replace on your hard disk, and the folders and files on your hard disk are exactly the same as the folders and files on your webspace - then if you upload those files after the search and replace, it's exactly the same as searching on your server. Searching and replacing on the server is slow and un-reliable. Doing it locally and then doing an upload is by far the best way to do it.

Example uses for SR Win:


You need to swap a sponsor and have 10,000 links to change.
You find a mistake in one of your links and realize it's on X number of pages.
You have been coding a tag incorrectly and need to fix it on a number of pages.

Homework


Do the tutorial again, but create a subfolder too with the "just a quick hello" files in them. Start SR Win off and see if you can get it to search and replace in a sub-folder too.

Good luck and happy replacing!

TOM ^"^


ICQ 12616560
Email tom@tomsnewbiebooster.com

Enter TOM'S NEWBIE BOOSTER

">Printer Friendly Version