renzlo 4 Junior Poster in Training

Hi All,

I have a text file which has a content like this:

network: Connecting http://webcodingtpp.nl.post.tnt:80/ with proxy=DIRECT
[09 Nov 2011 06:10:57.994] New imageNo= 0 mailPieceId= null imageLen= 0
[09 Nov 2011 06:10:57.994] imageInfo=null
[09 Nov 2011 06:10:58.510] requestGET = http://webcodingtpp.nl.post.tnt:80/servlet/TPP-BestemmingscoderenServlet?letterId=0&result=0
[09 Nov 2011 06:10:58.510] connecting to the servlet...
network: Connecting http://webcodingtpp.nl.post.tnt:80/servlet/TPP-BestemmingscoderenServlet?letterId=0&result=0 with proxy=DIRECT
[09 Nov 2011 06:10:58.760] New imageNo= 0 mailPieceId= null imageLen= 0
[09 Nov 2011 06:10:58.760] imageInfo=null
[09 Nov 2011 06:10:59.276] requestGET = http://webcodingtpp.nl.post.tnt:80/servlet/TPP-BestemmingscoderenServlet?letterId=0&result=0
[09 Nov 2011 06:10:59.276] connecting to the servlet...
network: Connecting http://webcodingtpp.nl.post.tnt:80/servlet/TPP-BestemmingscoderenServlet?letterId=0&result=0 with proxy=DIRECT
[09 Nov 2011 06:10:59.511] New imageNo= 0 mailPieceId= null imageLen= 0
[09 Nov 2011 06:10:59.511] imageInfo=null
[09 Nov 2011 06:11:00.027] requestGET = http://webcodingtpp.nl.post.tnt:80/servlet/TPP-BestemmingscoderenServlet?letterId=0&result=0
[09 Nov 2011 06:11:00.027] connecting to the servlet...
network: Connecting http://webcodingtpp.nl.post.tnt:80/servlet/TPP-ProductcoderenServlet?letterId=0&result=0 with proxy=DIRECT
[09 Nov 2011 07:39:56.403] New imageNo= 0 mailPieceId= TPP;UT2;PAR;PRO;2011;11;09;00;39;18;349;002;0000000232 imageLen= 0
[09 Nov 2011 07:39:56.403] imageInfo=null
[09 Nov 2011 07:39:56.918] requestGET = http://webcodingtpp.nl.post.tnt:80/servlet/TPP-ProductcoderenServlet?letterId=0&result=0
[09 Nov 2011 07:39:56.918] connecting to the servlet...
network: Connecting http://webcodingtpp.nl.post.tnt:80/servlet/TPP-ProductcoderenServlet?letterId=0&result=0 with proxy=DIRECT
[09 Nov 2011 07:39:57.152] New imageNo= 0 mailPieceId= TPP;UT2;PAR;PRO;2011;11;09;00;39;18;349;002;0000000232 imageLen= 0
[09 Nov 2011 07:39:57.152] imageInfo=null
[09 Nov 2011 07:39:57.666] requestGET = http://webcodingtpp.nl.post.tnt:80/servlet/TPP-ProductcoderenServlet?letterId=0&result=0
[09 Nov 2011 07:39:57.666] connecting to the servlet...
network: Connecting http://webcodingtpp.nl.post.tnt:80/servlet/TPP-ProductcoderenServlet?letterId=0&result=0 with proxy=DIRECT
[09 Nov 2011 07:39:57.900] New imageNo= 0 mailPieceId= TPP;UT2;PAR;PRO;2011;11;09;00;39;18;349;002;0000000232 imageLen= 0
[09 Nov 2011 07:39:57.900] imageInfo=null
[09 Nov 2011 07:39:58.415] requestGET = http://webcodingtpp.nl.post.tnt:80/servlet/TPP-ProductcoderenServlet?letterId=0&result=0
[09 Nov 2011 07:39:58.415] connecting to the servlet...
network: Connecting http://webcodingtpp.nl.post.tnt:80/servlet/TPP-ProductcoderenServlet?letterId=0&result=0 with proxy=DIRECT
[09 Nov 2011 07:39:58.649] New imageNo= 0 mailPieceId= TPP;UT2;PAR;PRO;2011;11;09;00;39;18;349;002;0000000232 imageLen= 0
[09 Nov 2011 07:39:58.649] imageInfo=null
[09 Nov 2011 07:39:59.164] requestGET = http://webcodingtpp.nl.post.tnt:80/servlet/TPP-ProductcoderenServlet?letterId=0&result=0
[09 Nov 2011 07:39:59.164] connecting to the servlet...

I want to find this line:

network: Connecting http://webcodingtpp.nl.post.tnt:80/servlet/TPP

But as you can see from the source above, it has two tasks:

network: Connecting http://webcodingtpp.nl.post.tnt:80/servlet/TPP-BestemmingscoderenServlet?letterId=0&result=0 with proxy=DIRECT
and
network: Connecting http://webcodingtpp.nl.post.tnt:80/servlet/TPP-ProductcoderenServlet?letterId=0&result=0 with proxy=DIRECT

Now my question is, is it possible to extract the contents of the source file, base on the found string? Some sort of boundary.

To make it simple, the output should be like this:

TPP-BestemmingscoderenServlet.txt
network: Connecting http://webcodingtpp.nl.post.tnt:80/ with proxy=DIRECT
[09 Nov 2011 06:10:57.994] New imageNo= 0 mailPieceId= null imageLen= 0
[09 Nov 2011 06:10:57.994] imageInfo=null
[09 Nov 2011 06:10:58.510] requestGET = http://webcodingtpp.nl.post.tnt:80/servlet/TPP-BestemmingscoderenServlet?letterId=0&result=0
[09 Nov 2011 06:10:58.510] connecting to the servlet...
network: Connecting http://webcodingtpp.nl.post.tnt:80/servlet/TPP-BestemmingscoderenServlet?letterId=0&result=0 with proxy=DIRECT
[09 Nov 2011 06:10:58.760] New imageNo= 0 mailPieceId= null imageLen= 0
[09 Nov 2011 06:10:58.760] imageInfo=null
[09 Nov 2011 06:10:59.276] requestGET = http://webcodingtpp.nl.post.tnt:80/servlet/TPP-BestemmingscoderenServlet?letterId=0&result=0
[09 Nov 2011 06:10:59.276] connecting to the servlet...
network: Connecting http://webcodingtpp.nl.post.tnt:80/servlet/TPP-BestemmingscoderenServlet?letterId=0&result=0 with proxy=DIRECT
[09 Nov 2011 06:10:59.511] New imageNo= 0 mailPieceId= null imageLen= 0
[09 Nov 2011 06:10:59.511] imageInfo=null
[09 Nov 2011 06:11:00.027] requestGET = http://webcodingtpp.nl.post.tnt:80/servlet/TPP-BestemmingscoderenServlet?letterId=0&result=0
[09 Nov 2011 06:11:00.027] connecting to the servlet...

ProductcoderenServlet.txt
network: Connecting http://webcodingtpp.nl.post.tnt:80/servlet/TPP-ProductcoderenServlet?letterId=0&result=0 with proxy=DIRECT
[09 Nov 2011 07:39:56.403] New imageNo= 0 mailPieceId= TPP;UT2;PAR;PRO;2011;11;09;00;39;18;349;002;0000000232 imageLen= 0
[09 Nov 2011 07:39:56.403] imageInfo=null
[09 Nov 2011 07:39:56.918] requestGET = http://webcodingtpp.nl.post.tnt:80/servlet/TPP-ProductcoderenServlet?letterId=0&result=0
[09 Nov 2011 07:39:56.918] connecting to the servlet...
network: Connecting http://webcodingtpp.nl.post.tnt:80/servlet/TPP-ProductcoderenServlet?letterId=0&result=0 with proxy=DIRECT
[09 Nov 2011 07:39:57.152] New imageNo= 0 mailPieceId= TPP;UT2;PAR;PRO;2011;11;09;00;39;18;349;002;0000000232 imageLen= 0
[09 Nov 2011 07:39:57.152] imageInfo=null
[09 Nov 2011 07:39:57.666] requestGET = http://webcodingtpp.nl.post.tnt:80/servlet/TPP-ProductcoderenServlet?letterId=0&result=0
[09 Nov 2011 07:39:57.666] connecting to the servlet...
network: Connecting http://webcodingtpp.nl.post.tnt:80/servlet/TPP-ProductcoderenServlet?letterId=0&result=0 with proxy=DIRECT
[09 Nov 2011 07:39:57.900] New imageNo= 0 mailPieceId= TPP;UT2;PAR;PRO;2011;11;09;00;39;18;349;002;0000000232 imageLen= 0
[09 Nov 2011 07:39:57.900] imageInfo=null
[09 Nov 2011 07:39:58.415] requestGET = http://webcodingtpp.nl.post.tnt:80/servlet/TPP-ProductcoderenServlet?letterId=0&result=0
[09 Nov 2011 07:39:58.415] connecting to the servlet...
network: Connecting http://webcodingtpp.nl.post.tnt:80/servlet/TPP-ProductcoderenServlet?letterId=0&result=0 with proxy=DIRECT
[09 Nov 2011 07:39:58.649] New imageNo= 0 mailPieceId= TPP;UT2;PAR;PRO;2011;11;09;00;39;18;349;002;0000000232 imageLen= 0
[09 Nov 2011 07:39:58.649] imageInfo=null
[09 Nov 2011 07:39:59.164] requestGET = http://webcodingtpp.nl.post.tnt:80/servlet/TPP-ProductcoderenServlet?letterId=0&result=0
[09 Nov 2011 07:39:59.164] connecting to the servlet...

Is it possible? Thanks in advance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.