LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 04-21-2004, 06:21 PM   #1
Nauguth
LQ Newbie
 
Registered: Oct 2003
Location: Seinäjoki, Finland
Distribution: Debian Testing, Ubuntu Hoary
Posts: 5

Rep: Reputation: 0
Rename and *-operator


Is it possible to use * sign at "rename -s" (or rename 's/\arg1/arg2/') arguments?

For example:

I have files test1_456, test2_776 and test3_487, and i want to strip the _-sign and everything that comes after that. Logically thinking command
Code:
rename -s '_*' '' test*
should do the trick, but it doesn't.

Is there some other way to do this, or have i just failed something?
 
Old 04-22-2004, 09:35 AM   #2
blueser
Member
 
Registered: Oct 2003
Location: Rio de Janeiro, Brazil
Distribution: Fedora Core 5
Posts: 76

Rep: Reputation: 15
I never used 'rename', and on Fedora it doesn't seem to have a '-s' option, but if it uses regexps, what you're saying with '_*' is '_ repeated 0 or more times', which is not what you want. Try using '_.*' instead (notice the '.' between '_' and '*' -- check grep's manpage for basic additional info on regexps).

HTH

Andre
 
Old 04-22-2004, 06:34 PM   #3
Nauguth
LQ Newbie
 
Registered: Oct 2003
Location: Seinäjoki, Finland
Distribution: Debian Testing, Ubuntu Hoary
Posts: 5

Original Poster
Rep: Reputation: 0
I have somewhat modified version of rename. That -s operator is just supposed to do same stuff as 's/\//'-format, it just uses little easier syntax. It does not, however, use regexps, but thankfully 's/\//' does, and your advice worked perfectly for that.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ operator += uman Programming 1 02-20-2005 04:37 PM
What is this 'operator' user? ldp Slackware 5 12-30-2004 12:39 PM
operator precedence in C Majjj Programming 2 07-07-2004 11:48 AM
~ operator linuxanswer Programming 7 04-08-2004 04:56 PM
many thanks to the operator MasterC WannaLearnLinux Linux - Newbie 4 10-20-2003 01:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:13 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
Open Source Consulting | Domain Registration