DEV Community

hmble
hmble

Posted on • Originally published at hmble.dev on

How to use rename unix utility command ?

Aaj hum rename command k perl version k baare me padenge.

Hum perl version of rename command ka use saare whitespace character ko ek sath remove ya change karne k liye use kar sakte. Lets see an example jaha hum se jyada files jinke name me whitespace hai usse - change kaise kar sakte.

Us se pahle lets see how we can install perl version of rename.

Install rename in Ubuntu

$ sudo apt install rename
Enter fullscreen mode Exit fullscreen mode

Install rename in Centos or Fedora

$ sudo yum install prename
Enter fullscreen mode Exit fullscreen mode

Install rename in Arch Linux

$ sudo pacman -s perl-rename
Enter fullscreen mode Exit fullscreen mode

Considering k aapne successfully rename command install kar li ab hum dekhte k hai k batch rename kaise kar sakte.

Remove whitespace from a filename

$ rename 'y/ /-/g' *.txt
Enter fullscreen mode Exit fullscreen mode

Top comments (0)