Tuesday, February 15, 2011

Cygwin:- What is Cygwin & How to set up?

 "Cygwin is a Unix-like environment and command-line interface for Microsoft Windows" says Wiki. Programmers who wants to practice Unix usually install RedHat Linux in their PC's usually as a dual-boot or through VM. This process demands us to completely boot the OS before we start working. For users who are interested only in programming like C, C++, Java, Shell scripting, Perl scripting, etc.. we dont need to install the entire RedHat linux at all. Cygwin is the perfect alternative for you. Cygwin is a utility like any windows software. Once cygwin is installed, working on Unix is just like working on say a Microsoft word document. Just double click on the shortcut and you are inside the terminal. No need to wait for booting, etc. Cygwin installs every Unix command like a windows executable and hence invokes just like any windows utility.

Tuesday, February 8, 2011

sed - Replace or substitute file contents

 In one our earlier articles, we saw how to insert a line or append a line to an existing file using sed. In this article, we will see how we can do data manipulation or substitution in files using sed.

Let us consider a sample file, sample1.txt, as shown below:

Thursday, February 3, 2011

3 different ways of renaming a group of files

  While dealing with multiple file operations, it is very common to have a scenario where we would like to rename to set of files, say set of txt files to some other extension, or a set of non-extension files to a new 
extension, etc. In this article, we will see 3 different ways to rename the files.

1. To rename a set of stand alone files to a .txt extension. Assuming the directory contains the files file1, file2 and file3.