![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| For loop using find with file name spaces | mronsman | UNIX for Dummies Questions & Answers | 3 | 09-12-2008 09:23 AM |
| Variable problem in for loop with if statement | ejdv | Shell Programming and Scripting | 6 | 06-17-2008 09:52 AM |
| For loop statement - catch error | lumdev | Shell Programming and Scripting | 4 | 09-20-2007 08:50 AM |
| if statement in a while loop | bobo | UNIX for Dummies Questions & Answers | 2 | 11-07-2006 12:38 PM |
| if statement in for loop of a string | Sniper Pixie | UNIX for Dummies Questions & Answers | 7 | 03-02-2006 07:28 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
For loop find statement file name manipulation
Code:
for i in `find . -name "*.BEFORE_DISASTER_RECOVERY"`;do dir_name=`dirname $i`;file_name=`basename $i`;cd $dir_name;mv $file_name (STUCK HERE) ;pwd;cd $BASE_DIR;done Okay, so I was able to get to this point. As you can see, I have a small for loop that searches for any files with the string BEFORE_DISASTER_RECOVERY in the file name, it then sets two variables dir_name and file_name, cd's to the dir_name directory, and then this is where I'm stuck. I need to mv $file_name to $filename minus ".BEFORE_DISASTER_RECOVERY. I'm sure it's something simple, but this is where I'm currently stuck. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|