private static void runclient(String[] args) throws FileNotFoundException,
			IOException {
		//Get the addresses of machines from the property file
		Properties prop = new Properties();
		FileInputStream fis = new FileInputStream("./boltdb.prop");
		prop.load(fis);
		fis.close();
		ClientArgs clientArgs = new ClientArgs();
		
		//Create an object to store the key,value and other grep options
		StringBuilder options = new StringBuilder();
		for (int j = 0; j < args.length; j++) {
			if (args[j].equals("-key")) {
				clientArgs.setKeyRegExp(args[++j]);
			} else if (args[j].equals("-value")) {
				clientArgs.setValRegExp(args[++j]);
			} else {
				options.append(args[j]);
				options.append(" ");
			}
		}
		clientArgs.addOption(options.toString());
		if (clientArgs.getKeyRegExp().isEmpty()
				&& clientArgs.getValRegExp().isEmpty()) {
			System.out.println("ERROR : Both key and value parameters missing");
		}
		
		String[] addresses = prop.getProperty("machines.address").split(",");
		//Create and start a list of client threads. Each thread takes server address and port as input.
		LinkedList<Thread> clientThreads = new LinkedList<Thread>();
		for (int i = 0; i < addresses.length; i++) {
			String[] hostPort = addresses[i].split(":");
			InetAddress address = InetAddress.getByName(hostPort[0]);
			Thread newThread = new LogQuerierClientThread(address,
					Integer.parseInt(hostPort[1]), clientArgs);
			newThread.start();
			clientThreads.add(newThread);
		}
		//Each thread would create a temp file to store the grep output
		//from the server it talked to. This part of the code keeps track
		//completed threads. Once a thread completes,we open up the temp file
		//and print it out to the console.
		int completedThreads = 0;
		while (completedThreads != addresses.length) {
			for (int i = 0; i < clientThreads.size(); i++) {
				if (!clientThreads.get(i).isAlive()) {
					completedThreads++;
					printOutput(clientThreads.get(i));
					clientThreads.remove(i);
				}
			}
		}

	}