This Program can be used to extract documentum object ids from Log File
import java.io.BufferedReader; import java.io.FileOutputStream; import java.io.FileReader; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; public class FileOperationToExtractObjectId { public static void main(String[] args) throws Exception { System.out.println("Start"); ArrayList idmlist = new ArrayList(); // Specify the log file from which the ObjectIds are to be extracted // below FileReader fr = new FileReader("LogFile.log"); BufferedReader br = new BufferedReader(fr); String s = new String(""); char[] temparr = (char[]) null; StringBuffer tempBuff = new StringBuffer(""); System.out.print("Process "); int countline = 1; while ((s = br.readLine()) != null) { for (int i = 0; i < s.length() - 1; i++) { if ((s.charAt(i) != '0') || (s.charAt(i + 1) != '9')) continue; tempBuff = new StringBuffer(""); tempBuff.append("'"); if (s.charAt(i - 1) == ' ') tempBuff.append(s.substring(i, i + 16)); tempBuff.append("'"); idmlist.add(tempBuff.toString()); i += 14; } if (countline % 5 == 0) countline++; } br.close(); fr.close(); Collections.sort(idmlist); System.out.println("\nEND [Saved : Idfile.txt]"); Iterator ite = idmlist.iterator(); tempBuff = new StringBuffer(""); String old_id = new String(""); String id = new String(""); int count = 0; while (ite.hasNext()) { id = (String) ite.next(); if (old_id.equalsIgnoreCase(id)) { continue; } tempBuff.append(id + ","); old_id = id; count++; } tempBuff.append("\nTotal Count : " + count); FileOutputStream fout = new FileOutputStream("Idfile.txt"); byte[] buff = tempBuff.toString().getBytes(); fout.write(buff); fout.close(); } }