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

410
Views
¿Cómo eliminar las primeras 2 letras de varios nombres de archivos en el shell de Linux?

Tengo archivos con los nombres:

 Ff6_01.png Ff6_02.png Ff6_03.png ... ... FF1_01.png FF1_02.png FF1_03.png

Quiero eliminar las dos primeras letras de cada nombre de archivo, porque entonces tendría un orden correcto de los archivos. ¿Alguien sabe el comando en el shell de Linux?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Puede usar la sintaxis ${file:2} para hacer referencia al nombre a partir del tercer carácter.

Por lo tanto, puede hacer:

 for file in F*png do mv "$file" "${file:2}" done

En caso de que ${file:2} no te funcione (ni rename ), también puedes usar sed o cut :

 for file in F*png do new_file=$(sed 's/^..//' <<< "$file") <---- cuts first two chars new_file=$(cut -c3- <<< "$file") <---- the same mv "$file" "$new_file" done

Prueba

 $ file="Ff6_01.png" $ touch $file $ ls Ff6_01.png $ mv "$file" "${file:2}" $ ls 6_01.png
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!