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

178
Visualizações
Linux returning every word of a windows path as a different path

I've been having the following issue:

I have a several paths (folders and files), that were done in either MAC or Windows system. Now in our server we want to automatize the access to them, and it should have been pretyt straight forward, but when we try this:

for subfolder in $(find $folder -mindepth 1 -maxdepth 3 -type d -name "A1*"); do
            name=$(basename $subfolder)
            echo $subfolder

What I got is something like this:

/home/datset/Data/A1
protease
from
Bytw
noth
(P456678888)

I've tried every sed, awk, whatever I could get my hand on that I thought it could work, but nothing has worked. I tried \r \n \^M.... Has anyone have an idea?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I guess your file name contains spaces (/home/datset/Data/A1 protease from Bytw noth (P456678888))?

The shell splits what is returned by your "find" at spaces.

find $folder -mindepth 1 -maxdepth 3 -type d -name "A1*" -print | while read subfolder; do
    name=$(basename "$subfolder")
    echo "$subfolder"

Note the quotes to ensure the integrity of the file names.

over 4 years ago · Santiago Trujillo 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