Site Moved

This site has been moved to a new location - Bin-Blog. All new post will appear at the new location.


Learning Sed - and Making SedGUI

I am trying to learn Sed(Stream EDitor). Sed is basically a small(but powerful) utility which you can use to filter files based on regular expressions. You can use it to

  • Find the lines that match the given regular expression.
  • Replace an expression with another.
  • Get the file contents from one point to another - the points can be a line number or even a regular expression.
  • And much more...

I am using the tutorial at There is also a nice collection of tutorials at

Anyway since I know Regular Expression, I did not have any trouble learning the stuff. The trouble is using it. Don't get me wrong - Sed is a very powerful and very useful program - that sed(sorry, couldn't resist), it is very user unfriendly. If you know sed, you know that it has no GUI - it is a program that can only be run from command line. You define the regexps that must be matched, the file to be used and call the program. You can either see the results on screen or save it to another file. If you are saving it to another file - like with this command... sed 's/BEGIN/begin/' <old >new you have no clue whether any thing was changed. Another problem is that if there are multiple commands you wish to execute, the code quickly becomes un-handleable.

Despite all this issues, I could not abandon Sed - it is very useful for me. So I have decided to make my own little Sed like tool - SedGUI. Since this involves a lot of Regular Expressions, Perl is the obvious choice for the language. I will use Perl Tk to create a small GUI for the program. I have started the work on this program - I already have a working prototype. It is no where near release stable - so don't wait around for the download link. This is what I have done till now... It is nowhere near complete - I have just had one day of coding. I will let you know as soon as I release a beta version. Till then, use Sed.

Filed Under...

Categories : Technorati Tags: