ContributionsMost RecentMost LikesSolutionsRe: How to get the next 15 line after the date with groovy script I'll anwser myslef since I solved it : writeFile.withWriter { writer -> // read the file using a reader readFile.withReader{ reader -> while (line = reader.readLine()) { // if line starts with your comment "'" if(line.contains(threadInfo)){ def lineCount = 0 while(lineCount < lineCountMax) { def nextLine = reader.readLine() // to the current line, and writeit in the result file writer << "${nextLine}" << System.properties.'line.separator' lineCount ++; } } } } } thx anyaway ! How to get the next 15 line after the date with groovy script Hello eveyrone, I have another problem, I'm trying to get a number of line after a specific date is found in my file. for example, if I found the date in my File, I would like to write, in another file the 15 lines after it. I start to write something such as : resultFile.withWriter{ writer -> readFile.withReader{ reader -> while (line = reader.readLine()) { if(line.startsWith(dateRequest)){ writer << "${line}" << System.properties.'line.separator' } } } } But I don't know how to add the next 15 line each time ? What's important for me here is the date before the soap service. What I want to do is : for each date when a soap service is send write the 15 line after this date in another file Do it again for other soap serice with the same date Also, the thing is that it's log file which is used by a lot of people so a lot of saop service are not from me and it's not possible to differenciate them expect with the date Do you know how ? Thanx in advance ! SolvedRe: How to get the next 15 line after the date with groovy script Hello, But yes, it's indeed the same and that's why I put it. What's important for me here is the date before the soap service. What I want to do is : for each date when a soap service is send write the 15 line after this date in another file Do it again for other soap serice with the same date Also, the thing is that it's log file which is used by a lot of people so a lot of saop service are not from me and it's not possible to differenciate them expect with the date Re: How to get the next 15 line after the date with groovy script Hello, I can't show the file but it's a log file with something like : Then for each part that I got for example the same date, I want to write the next 15 line (which represent my webservice) in another file 13/03/2019 15:24:48.424 [http-thread-pool-8080(18)] <?xml version='1.0' encoding='UTF-8'?> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Header> <OS_Header xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="os.xsd.v1" xsi:nil="true"/> </wsse:UsernameToken> </wsse:Security> </S:Header> <S:Body> Re: How to get the start time of a request and of the response in groovy script ? Thanx It works :D And thx eveyrone for your help ! Re: How to get the start time of a request and of the response in groovy script ? It's not clear to me because I get the following result with getTimestamp : 1553695803464 How is it a date ? How to get the start time of a request and of the response in groovy script ? Hello eveyrone ! I have been searching a lot about that and didn't find an answer. I would like to know how in groovy script, I can have the time of whenthe request was send and the time of when the response was send ? Thanx in advance for your help ! Luc. Solved