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

154
Visualizações
Use PHP to break a list at every nth line to create CSV

Per criticism, I have focused the question to PHP, but alternative solutions--including javascript, python, and Excel--are acceptable.

Given the following list how do break it into a tab-delineated csv at every nth record (i.e., 3) ?

Apples
Sweet and juicy, these babies are in season!
$2
Bananas
Packed with essential vitamins, our organic bananas are perfect for a snack!
$1
Peaches
Juicy Georgia peaches are available!
$2
Tomatoes
Our variety is the perfect mix of juicy and hearty for your summer salads!
$1
Cucumbers
These cucumbers pair with tomatoes for amazing salads.
$2

The desired output would be

Apples\tSweet and juicy, these babies are in season!\t$2\n
Bananas\tPacked with essential vitamins, our organic bananas are perfect for a snack!\y$1\n
Peaches\tJuicy Georgia peaches are available!\t$2\n
Tomatoes\tOur variety is the perfect mix of juicy and hearty for your summer salads!\t$1\n
Cucumbers\tThese cucumbers pair with tomatoes for amazing salads.\t$2\n

I have attempted this exercise in SublimeText with regex but cannot master the pattern to match every nth occurrence.

Any solution will do. I just need to parse thousands of records into a spreadsheet.

about 4 years ago · Juan Pablo Isaza
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