Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

127
Views
How to capture next tine after the certain previous line in the node.js

Log file has certain string happening several time. I need to capture next line for all occurrences of this previous string with node.js. For example content of the file:

Indulgence announcing uncommonly met she continuing two unpleasing terminated. Now busy say down the shed eyes roof paid her  
Compile Error  
./aaarty/bbb/cfvcc/dddhjklpi  
Course suffer to do he sussex it window advice. Yet matter enable misery end extent common men should. Her indulgence but assistance favourable cultivated everything collecting  
Compile Error  
./asshtyd/wrfber/ghn/fffh/gh/ikjmlk  
Extended kindness trifling remember he confined outlived if. Assistance sentiments yet unpleasing say  
Compile Error  
./cc/wwwasftbb/kkk/tgfh/pioqascfg/qqq  
Open they an busy they my such high  strong text  

Using node.js I need to capture each line that goes after the line with the string "Compile Error"

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I got it:

var fs = require('fs');
var array = 
fs.readFileSync('mylogfile.txt').toString().split("\n");
    for(let i in array) {
       if (array[i] == "Compilation Error")
          {
            let k = parseInt(i)+parseInt(1)
            console.log(array[k])
          }
    }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!