Last active
November 6, 2020 04:58
-
-
Save frjufvjn/b2bbf8f9d222f632853893c2c6a180d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<String> orgList = new ArrayList<String>(); | |
final File f = new File("C:/doc/IS-MON/신한카드/텔레캡스 등록현황.txt"); | |
try (BufferedReader inFile = new BufferedReader(new FileReader(f));) { | |
String line = null; | |
while( (line = inFile.readLine()) != null ) { | |
// System.out.println(line); //읽어들인 문자열을 출력 합니다. | |
String[] spl = line.split("\\\t"); | |
if (spl != null) { | |
if (spl.length > 0) { | |
String deviceId = spl[0]; | |
String item = ""; | |
for (int i=1; i<spl.length; i++) { | |
if (!"".equals(spl[i])) { | |
item = spl[i]; | |
} | |
} | |
System.out.println(String.format("deviceid:%s, item:%s", deviceId, item)); | |
orgList.add(deviceId + "|" + item); | |
} | |
} | |
} | |
System.out.println(orgList.toString()); | |
List<String> sampleList = new ArrayList<>(); | |
sampleList.add("prpdsbr1|/opt/avaya"); | |
orgList.forEach(o -> { | |
String[] spl = o.split("\\|"); | |
final String deviceId = spl[0]; | |
final String item = spl[1]; | |
sampleList.forEach(s -> { | |
String[] _spl = s.split("\\|"); | |
final String _deviceId = _spl[0]; | |
final String _item = _spl[1]; | |
if (deviceId.equals(_deviceId) && item.equals(_item)) { | |
System.out.println("deviceId:" + deviceId + "-->" + item); | |
} | |
}); | |
}); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment