LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 04-28-2008, 06:04 PM   #1
Peterius
Member
 
Registered: May 2004
Distribution: Gentoo, Debian, OpenBSD, NetBSD
Posts: 158

Rep: Reputation: 16
Question Batch renaming without using "for" in bash shell {}


I'm pretty sure I've seen something like:
mv filename{.*} newfilename{} or something like that where the bash shell fills in the second thing with whatever is in the {} for the first one.

I tried googling "}" but to no avail. Just kidding, but seriously, does anyone know the form for this thing? I hate to screw with "find --exec" or lines like "for $i...;", etc., for such a simple thing.
 
Old 04-28-2008, 06:25 PM   #2
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
that's a brace expansion. do 'man bash' and look for the BRACE EXPANSION section. The thing just simply expands arguments to it to parameters in the command. doing 'echo {abc,b}1234' is just like doing 'echo abc1234 b1234'
 
Old 04-28-2008, 07:39 PM   #3
Peterius
Member
 
Registered: May 2004
Distribution: Gentoo, Debian, OpenBSD, NetBSD
Posts: 158

Original Poster
Rep: Reputation: 16
Thanks, damn... so much for my memory.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 7 12-19-2015 01:03 AM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
Shell and batch operations on hidden files but not on ".." & "." danielsbrewer Linux - Software 5 09-12-2007 08:06 AM
Root user bash shell look like "bash-2.05b#" and /root empty y2pk001 Linux - Security 6 03-22-2007 08:33 PM
Batch Renaming in bash xushi Programming 6 07-07-2005 03:24 PM

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

All times are GMT -5. The time now is 09:39 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