Monday, March 28, 2011

Different ways to add header and trailer line to a file

   In this article, we will see the different ways to add a header record or a trailer record to a file.

Let us consider a file, file1.
$ cat file1
apple
orange
grapes
banana

Thursday, March 17, 2011

Different ways to delete ^M character in a file

 Control-M is a character found at the end of a line usually in files transferred from windows. Before, processing these files in UNIX, we need to remove the ^M characters. Let us see in this article, the different ways to delete the Control-M from the files:

 Consider a file, file1, which has the control M characters:
$ cat -v file1
a^M
b^M
c^M
d^M
e^M
f^M

Tuesday, March 15, 2011

comm - The beautiful comparison

 comm is one of the most underused commands in UNIX. I have seen many times programmers resorting to writing a shell script to achieve something which comm could have done it easily. Let us see how to use this comm command.

 Say, you have a file, file1, which contains the list of files present in a version. And file2 contains the list of files received in the next version:

Thursday, March 10, 2011

Oracle 10g Express: How to set up Oracle XE?

  Oracle XE is a Oracle Express edition Oracle software provided by Oracle. This software allows developers to install Oracle in their computer and practice Oracle and PL/SQL.

Steps for Installation:
1. Download the Oracle Database 10g Express Edition software fromOracle XE.
2. Install the software just like any windows software.
3. During Installation, it will ask you for password. Remember the credentials. The username is SYS.

Tuesday, March 8, 2011

Difference between $* and $@ in Shell

 In one of our earlier articles, we saw the different positional parameters in a shell script. We discussed about the positional parameter $*. There is one more positional parameter, $@, the definition of which is also the same as $*. Let us see in this article the exact difference between the parameters $* and $@.

Tuesday, March 1, 2011

sqlplus - Access multiple query results from shell

  In one of our earlier articles, we saw how we can execute a SQL query by connecting to sqlplus. In this, we will see how we can execute multiple queries and access the values inside shell.