Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

132
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda