LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-27-2005, 10:53 AM   #1
adenardo
Member
 
Registered: Oct 2001
Location: Fort Collins, Colorado
Distribution: RHEL3/FedoraCore3
Posts: 61

Rep: Reputation: 15
replacing single quotes in file names


I have a bunch of photos called things like:

ben's birthday.jpg
ben's first day skiing.jpg
haille's dog.jpg

I want to automate the removal of the single quotes, changing their names to:

bens birthday.jpg
bens first day skiing.jpg
hailles dog.jpg

I have used :

for i in *.jpg; do mv "$i" `echo $i | tr ' ' '_'`; done

to replace spaces in filenames with underscores. I have been unable to modify this to work for single quotes. any help appreciated :-)
 
Old 05-27-2005, 11:02 AM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Reading the man page for tr, doesn't seem to have a specific option for the back tick.. '

You might have to provide it with the octal number.. from the man page:

\NNN character with octal value NNN (1 to 3 octal digits)
 
Old 05-27-2005, 12:29 PM   #3
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 45
Re: replacing single quotes in file names

hi there,

Quote:
Originally posted by adenardo

for i in *.jpg; do mv "$i" `echo $i | sed "s/'//g"`; done
did you try sed???
regards
slackie1000
 
  


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
Problems with quotes and double quotes Andruha Slackware 6 01-02-2010 05:44 PM
Single IP multible domain names tangle Linux - Networking 4 11-25-2005 01:17 AM
Using single quotes vs double quotes in PHP strings vharishankar Programming 6 07-11-2005 12:41 PM
Replacing a particular position in a file sgracelin Linux - Newbie 1 06-20-2005 06:54 PM
In BASH shell, what is the difference in usage between single and double quotes? davidas Linux - Newbie 2 04-05-2004 04:00 AM


All times are GMT -5. The time now is 11:02 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration