Guest User

Untitled

a guest
Dec 17th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. I am reading input from file it contains set of lines as below :
  2. BDI100 172.20.1.5 YES TFTP up up
  3. BDI500 172.20.1.50 YES TFTP up up
  4. BDI600 172.20.1.58 YES TFTP up up
  5.  
  6. i have to extract the complete line which contains only 172.20.1.5
  7.  
  8. Below is my code :
  9. while ((line = lineNumberReader.readLine()) != null) {
  10. Pattern p = Pattern.compile(expr.trim()); /*expr is filter contains 172.20.1.5 */
  11. Matcher m = p.matcher(line);
  12. if(m.find()){
  13. System.out.println(line);
  14. }
  15. }``
Add Comment
Please, Sign In to add comment