Text file content should like this: 1.txt : accountsservice :: 0.6.40-2ubuntu11.3 :: None :: amd64 :: None 2.txt : cronie-anacron::1.4.11::17.el7::x86_64::Friday 05 January 2018 11:13:34 AM
package Programm; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class StringEqual{ public static void main(String[]args){ BufferedReader in = null; BufferedReader in2 = null; try { in = new BufferedReader(new FileReader("/home/msr/Music/Ubuntu.txt")); in2 = new BufferedReader(new FileReader("/home/msr/Music/centos.txt")); String read = null; String read2 = null; while ((read = in.readLine()) != null && (read2 = in2.readLine())!= null) { String[] splited = read.split("::"); String[] spliter = read2.split("::"); for (String part : splited) { if(in!=in2) System.out.println("packages name matches:" + part); } for (String part2 : spliter) { if(in!=in2) System.out.println("packages not matched:" + part2); } } } catch (IOException e) { System.out.println("There was a problem: " + e); e.printStackTrace(); } finally { try { in.close(); } catch (Exception e) { } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)