LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-15-2017, 02:04 AM   #1
obe1978
LQ Newbie
 
Registered: Dec 2017
Posts: 2

Rep: Reputation: Disabled
How to RENAME files name with multiple dots (...)


Hello, recently I have discovered wonderful function like RENAME in Linux, I'm using it in script with function FIND to partly rename multiple files, for example:

find /srv/my_disk/ -type f -name '*.*' | rename 's/DVDRip/./'

after that change (and many others), new name have many dots in file name like:

Movie_Name ... 2010...avi

I wonder (because I can't do this in my way) how to remove any dot to nothing (delete all dots)?

I have tried:

find /srv/my_disk/ -type f -name '*.*' | rename '1,$s/\.\.//g'


but it doesn't work

any clue/idea?

ps. I don't wan to use any additional scripts, just use simple functions like FIND and RENAME

thanks in advance

Rob
 
Old 12-15-2017, 04:16 PM   #2
MadeInGermany
Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 792

Rep: Reputation: 348Reputation: 348Reputation: 348Reputation: 348
Delete two or more consecutive dots
Code:
rename 's/\.{2,}//g'
or
Code:
rename 's/\.\.+//g'
 
Old 12-15-2017, 07:21 PM   #3
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,208

Rep: Reputation: 705Reputation: 705Reputation: 705Reputation: 705Reputation: 705Reputation: 705Reputation: 705
If you want to keep the last dot of file extension (.avi)
Code:
rename 's/\.{2,}(?![^.]+$)//g'
 
Old 12-15-2017, 07:44 PM   #4
_roman_
Member
 
Registered: Dec 2017
Location: _Austro_Bavaria_
Distribution: gentoo / linux mint
Posts: 433

Rep: Reputation: 28
i think sed can do it

I was as of now lazy to learn advanced bash techniques.
 
Old 12-17-2017, 06:57 AM   #5
obe1978
LQ Newbie
 
Registered: Dec 2017
Posts: 2

Original Poster
Rep: Reputation: Disabled
THX 'MadeInGermany' - seams it works
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash - rename multiple files with dots in filename eldude543 Programming 20 05-20-2016 11:17 PM
[SOLVED] rename multiple files lghizoni Linux - Newbie 7 01-30-2013 08:48 AM
rename file names : replace dots by spaces, keep the extension Reda01 Programming 5 03-28-2011 08:54 AM
rename multiple files tjay1983 Programming 3 08-10-2010 12:43 AM
How to rename multiple files? Rostfrei Linux - Newbie 3 07-11-2006 06:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration