Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
10-11-2003, 12:22 AM
|
#1
|
|
Member
Registered: Sep 2003
Posts: 154
Rep:
|
2 Thumbs Up for Windows!
Why?
Because Ive spent the last half hour trying to do something in Linux that would be SIMPLE to do in Windows.
Whats that you ask?
Rename a bunch of files.
The Windows command would be simple:
ren GPO*.h CX*.h
In Windows this would rename all of the files that start with GPO, and end with .h to files that start with CX and end with .h
Simple...
To do this in Linux I guess Ill need to write code?
There HAS to be a better way.
|
|
|
|
10-11-2003, 12:37 AM
|
#2
|
|
Member
Registered: Sep 2003
Location: barneveld.nl
Distribution: Slackware
Posts: 170
Rep:
|
One word: mv
$ mv GPO*.h CX*.h
You could've done a seach on some online man pages website or an apropos about 'moving files'
|
|
|
|
10-11-2003, 12:46 AM
|
#3
|
|
Senior Member
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054
Rep:
|
to expand upon what wuck said. not only was there google or the forums' search, but you could've asked here too before posting like a schmuck. you may have gotten a few RTFM responses or use the forum search responses, but someone would have given you the command that wuck gave you.
|
|
|
|
10-11-2003, 12:53 AM
|
#4
|
|
Member
Registered: May 2003
Location: Kerala,India
Distribution: RedHat,Mandrake,Debian
Posts: 643
Rep:
|
i think there is 'rename' command in linux.i have never used it though.check the man page for more info.(man rename)
|
|
|
|
10-11-2003, 01:16 AM
|
#5
|
|
Senior Member
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 2,901
|
Quote:
Originally posted by megaspaz
to expand upon what wuck said. not only was there google or the forums' search, but you could've asked here too before posting like a schmuck. you may have gotten a few RTFM responses or use the forum search responses, but someone would have given you the command that wuck gave you.
|
yup megaspaz is right, posts like yours are the digital equivelant of throughing rocks at a bee hive, you will make the bees angry and most probably get stung serveral times 
Last edited by frieza; 10-11-2003 at 01:17 AM.
|
|
|
|
10-11-2003, 01:33 AM
|
#6
|
|
Member
Registered: Sep 2003
Posts: 154
Original Poster
Rep:
|
Uh....Hmmmm....
mv GPO*.h CX*.h doesnt work...
Maybe I can get a response from someone who knows about Linux?
Anyone? Is there a Linux expert in the house?
|
|
|
|
10-11-2003, 01:36 AM
|
#7
|
|
Senior Member
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054
Rep:
|
what kind of output are you getting? any error messages? are you in a directory that you have write permissions for? are you in that directory? more info needed. and try a "man rename"
|
|
|
|
10-11-2003, 01:39 AM
|
#8
|
|
Member
Registered: Sep 2003
Posts: 154
Original Poster
Rep:
|
rename doesnt work either... it gives no output whatsoever
mv GPO*.h CX*.h gives the following output:
mv: when moving multiple files, the last argument must be a directory.
|
|
|
|
10-11-2003, 01:41 AM
|
#9
|
|
Member
Registered: May 2003
Location: Kerala,India
Distribution: RedHat,Mandrake,Debian
Posts: 643
Rep:
|
Wow,you want torvalds or alen cox to come and explain to you the 'mv' and 'rename' command??
-------------
try 'rename <What_You_Want_to_Convert> <to> <file_name>
ie,
Code:
rename GPO CX GPO*.h
-------------------------------
--arun
|
|
|
|
10-11-2003, 01:44 AM
|
#10
|
|
Member
Registered: May 2003
Location: Kerala,India
Distribution: RedHat,Mandrake,Debian
Posts: 643
Rep:
|
and ofcourse,mv abc*.h vsdh*.h wont work.(obviously).mv is move(similar to cp).and you think * will be replaced with what??so you can move multiple files into a directory.(again obvious,.)
and it was easy in dos (to use 'ren') cos you knew that command.now that you know 'rename' you will find it easy.though it is sure that windows is much more userfriendly,it cannot be compared to your case.(rename is a fine tool.you couldnt rename cos you didnt knew abt 'rename'.the same thing applies to windows.)
Last edited by arunshivanandan; 10-11-2003 at 01:53 AM.
|
|
|
|
10-11-2003, 01:51 AM
|
#11
|
|
Member
Registered: Sep 2003
Posts: 154
Original Poster
Rep:
|
Well I think its a big problem with the mv command. If you can move one file to another it should do multiples. Same with cp, I shouldnt be forced to move or copy multiples to a directory.
Like I said, if it can be done in Windows.... sigh.
|
|
|
|
10-11-2003, 01:55 AM
|
#12
|
|
Member
Registered: May 2003
Location: Kerala,India
Distribution: RedHat,Mandrake,Debian
Posts: 643
Rep:
|
Did 'rename GPO CX GPO*.h' work for you??
|
|
|
|
10-11-2003, 01:59 AM
|
#13
|
|
Member
Registered: Oct 2003
Distribution: Red Hat 9
Posts: 93
Rep:
|
Change file extensions
for f in myfile.+([0-9])*
do
print mv $f ${f%*.}.new
done
Change all but extensions
for f in myfile.+([0-9])*
do
print mv $f newfile.${f##*.}
done
do it in a ksh shell.
OR
http://linux.maruhn.com/sec/ren.html
download, configure, install and use the ren command if you do this alot
Last edited by Col Panic; 10-11-2003 at 02:02 AM.
|
|
|
|
10-11-2003, 01:59 AM
|
#14
|
|
Member
Registered: Sep 2003
Posts: 154
Original Poster
Rep:
|
When I try it, Ill let you know...
|
|
|
|
10-11-2003, 02:02 AM
|
#15
|
|
Member
Registered: May 2003
Location: Kerala,India
Distribution: RedHat,Mandrake,Debian
Posts: 643
Rep:
|
i dont know why you guys make such a fuss abt something so trivial..............
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 03:58 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|