I need a text-replace program that can do this:

I need a shareware or free ware text search/replace application that can insert text at the end of the document in addition to the normal features such a program has.

Example:

Find Documents containing text: <html>
Insert at end: </html>

Any suggestions? Thanks.

I take it you’re using Windows? I can’t recommend any point-and-click program for this, but if it’s important enough to be worth some trouble – especially if you’re going to need to do this sort of thing again – you may want to get perl and learn how to use it.

You could try getting Ultraedit (shareware) and creating a quick macro (very easy). You just open a file, search for the string, go to the end of the line and then insert manually the </html> and then save the macro.

You can then let it run it self through the file until it’s done.

If you have access to a Linux box, something like should work (deep breath):


grep -l '<html>' * | xargs -ti bash -c "echo '</html>' >>{}" 

If you can put the files up on the web somewhere I could run it on my box, if the dataset’s not too big.

Good luck

And if not, you can use cygwin.

On a Mac, the grep incantation would work, you could use ‘sed’, or if you want a GUI application, use BBEdit.

This as good of a place as any to ask, if I hope to start learning Linux, would cygwin be a good place to start rather than a clean install on an old computer?

Cygwin is a unix-like environment that runs on top of Windows. It’s like having a user account (not root/administrator access) on your company/school’s unix system. I think it’s a good way to learn to use a unix system, including programming, but it won’t teach you much about administering a unix system.

I like having cygwin on my PC - it lets me use simple unix tools like grep and run simple shell scripts. It’s useful in cases exactly like this OP’s. It also works as an X-windows server to run graphical programs remotely - i.e. you log on to another machine and have it open a window on your screen.

Grep is the world’s most wonderful command line program, and you can use it on just about any operating system there is. It is built into Linux, Unix, Solaris, FreeBSD, and so forth. Mac OS X has it in the underlying BSD. You can download it for Windows and DOS.

If Grep can’t do everything you want, then get perl. When you do, hie thee to O’Reilly and get the camel book and llama book. I’ve written perl programs on a Linux box, debugged them on a Windows box, and then deployed them on a Sun box. It just works.

Hey, where’s the love for awk? That’s my command-line programmable filter of choice. I really need to get in more practice with it, though…

Thanks for the suggestions, but I’m kind of a klutz at learning code (as anyone who goes to my website can tell), so I was hoping for more of a shareware app of the type you find on download.com or versiontracker.com.

No fuss, no muss, and no rough stuff.

Err, what about my reply?

Shareware, 30-day limit, 1.7Mb…

And you never thought that none of those tools might be right for the job?

Frankly, it’s easier to learn something a bit complex than to pore through thousands of web pages and struggle with a tool that almost does what you want but is so simplistic you can’t make it solve the problem. There are very good Perl tutorials online and in book form, and taking some time now to work through one of them will make you capable of solving problems much faster in the future. What’s more, you won’t have to juggle a dozen ‘almost’-solutions or try to find a pre-written program that does something just a little bit closer to what you really need.

I’m sorry for the rant, but I wouldn’t be wasting my time if I didn’t think you could get something out of it.

Some free online resources:
[ul]
[li]http://www.perlmonks.org/index.pl?node_id=418141 – This assumes no prior programming experience. (HTML doesn’t really count, but JavaScript does.)[/li][li]Me, for one. Ask a question about Perl in GQ and it will get answered. This isn’t the best way to do it, but hopefully I or someone else will get you on the right track.[/li][/ul]

(Learning grep will probably be a lot harder, because the documentation isn’t aimed at someone like you. Once you know Perl, grep and awk will be a cinch, however.)

Oh, and two more references:
http://www.sthomas.net/oldpages/roberts-perl-tutorial.htm
http://www.perlmonks.org/index.pl?node=Tutorials

You can Google for ‘perl tutorial’ or ‘perl introduction’ if you want.

Sorry, I missed yours. Looking for the app now. Thanks.