Geek-9pm

Often batch programmers want to have a batch that will find and replace things in a text file. This can be called 'string substitution'. Of course you can do that in Notepad, but not from the command line. SED runs from a command and can be inside batch file. When done, SED goes back to the batch file.

SED is not included in Windows because it is really a Unix program. But it was ported to Windows so time ago and works very well.

The command line syntax is basically like this:SED s/abc/xyz/g filename

That means substitute xyz with abc for the whole file. Output is displayed.Well, yeah, there are a few more details. But the above is the idea.

Similar syntax, accept Perl does a lot more. Even not with Perl, awk is also a better suited tool to use than sed, because awk is a nice little programming language. There's no point learning sed nowadays because what sed can do, awk can do, and it does more as well.

Squashman

Geek,Why not just make sure SED is in your PATH instead of doing two commands to get to the path where it is installed.Why bother changing the directory where sed is installed. Either use the CD /d option or pushd if you want to set the working directory to where sed is installed. Or just spell out the whole path to the executable. I always prefer to set my working directory to where my input files are located.

Geek-9pm

SED is to be used as a command line utility. You have to open a CMD box, or 'DOS' box to run it. In the DOS box type PATH to see the path used for DOS commands.All such command line utilities have to be somewhere that can be found in the PATH used for commands in the command mode. This applies to all command line utilizes that are not GUI things. . Programs installed in the program directory are not available to the CMD or DOS box. With some exceptions. Presently I moved SED over to D:\gnu32\bin and put that at the end of the PATH. Yhat way I don't have to use the full path.

This first example I gave was far to complex. Here is is super simpleA file named OLD.TXT has:My name is ABC Jones,I line at 123 Main....now give the command:sed s/abc/xyz/ <OLD.TXT >NEW.TXTORsed s/123/789/ <OLD.TXT >NEW.TXTLook at the NEW.TXT file.Is that simple?

Right.The horrible thing about sed is the documentation goes on and on and on...So I wanted to give the very simple form that anybody can use without reading the manual. Again, this is about the version of sed that works in Windows.