Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I am reading input from file it contains set of lines as below :
- BDI100 172.20.1.5 YES TFTP up up
- BDI500 172.20.1.50 YES TFTP up up
- BDI600 172.20.1.58 YES TFTP up up
- i have to extract the complete line which contains only 172.20.1.5
- Below is my code :
- while ((line = lineNumberReader.readLine()) != null) {
- Pattern p = Pattern.compile(expr.trim()); /*expr is filter contains 172.20.1.5 */
- Matcher m = p.matcher(line);
- if(m.find()){
- System.out.println(line);
- }
- }``
Add Comment
Please, Sign In to add comment