Tuesday, February 28, 2012

Different ways to split the file contents

   In one of our earlier articles, we saw different ways to join all lines in a file. In this article, we will see the different ways in which we can split the file contents of a file.  Some even refer to this as converting rows into columns of a file.

Let us assume a file, say "a" with the following contents:
$ cat a

Tuesday, February 21, 2012

Login to a UNIX account from Windows without password

   UNIX users login to their unix boxes umpteen times in a day. Every time, while logging in, we give username and passwords which, takes quite a bit of time, if you happen to login many times in a day. In this article, we will see how we can login to a UNIX account without providing username and password using ssh.

Logging into an UNIX account usually happens in 2 ways:

1. User is already in a UNIX box or server. He tries to login to another UNIX server from the first one.
2. User logs into the UNIX box using putty installed in his Windows system.

Thursday, February 9, 2012

C program to multiply, divide and find reminder for x by 4 without arithmetic operators?

  One of my friends asked me an interesting interview question. The question is like this: How to multiply, divide and find reminder of a number X by 4 without using arithmetic operators?

   Since we are not supposed to use arithmetic operators, none of the +,-,*,/% can be used. Binary operators always help us in this regard.