I have two textfiles ,
Ex:first text is like this
AAA A B C D
..................
....................
ZZZ CC GG
Second text file is
A a
B b
C c
........
........
GG g
Like this
I have to print the content of AAA as A B C D and at the same time i have to ptint abcd in one line as the second output.
Now i already done the first step ie i print A B C D.Now i have the doubt is how can i print the abcd .Iam attaching my second part code with this .This is the code from aftr getting the first output
Expand|Select|Wrap|Line Numbers
- import java.io.*;
- import java.util.regex.*;
- class A
- {
- public static void main(String args[])
- {
- DataInputStream di = null;
- String rec=null;
- int recCount = 0;
- try
- {
- File s = new File("D:/s/pr/cmu_tam_map.txt");
- FileInputStream fi = new FileInputStream(s);
- BufferedInputStream bi = new BufferedInputStream(fi);
- di = new DataInputStream(bi);
- String out;
- String ou;
- String ouput ="K AH0 N T IH1 N Y UW0";
- String arr[]={};
- arr=ouput.split("\\s");
- while((rec=di.readLine()) != null)
- {
- for(int i=0;i<8;i++)
- {
- //System.out.println(arr[i]);
- if(rec.startsWith(arr[i]))
- {
- int len = rec.length();
- out = rec.substring(arr[i].length(),len);
- // System.out.print(out);//continue;
- // String ne=out;
- System.out.print(out);
- }
- }
- }
- recCount++;
- }
- catch (IOException e)
- {
- System.out.println("Uh oh, got an IOException error!" + e.getMessage());
- }
- finally
- {
- if (di != null)
- {
- try
- {
- di.close();
- }
- catch (IOException ioe)
- {
- }
- }
- }
- }
- }