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

177
Views
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 answers
Answer question

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 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!