![]() |
|
|
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 |
| Seems Complicated but would b happy if its possible | anushree.a | Shell Programming and Scripting | 6 | 05-28-2008 06:25 AM |
| Sort complicated two fields | lalelle | Shell Programming and Scripting | 3 | 04-17-2008 06:15 PM |
| complicated(?) grep | khearnen | UNIX for Dummies Questions & Answers | 5 | 04-07-2008 01:03 PM |
| More complicated log parsing | sjug | Shell Programming and Scripting | 25 | 06-13-2007 10:33 AM |
| Need help with complicated script (reading directories, extracting data) | Gill Bates | Shell Programming and Scripting | 3 | 02-20-2007 07:05 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Quote:
What is the previous post ? Could you be even more specific with your requirement ? |
|
||||
|
Here are the details
Greetings,
I am new to scripting, but find if I can see the code working for a given problem, then I can eventually figure it out. So, If ye dare, if yes be brave enough, then step forward to help me with this ---please. I've just loaded a CD's worth of reference images. The images follow a naming scheme such as DSCN-1.JPG, DSCN-2.JPG ... DSCN-10.JPG, although the frame numbers may be noncontiguous (i.e., there may be gaps between numbers). Although the frames were stored in separate directories on the CD-ROM from which they were loaded, all of the frames have now been placed into this directory: /shots/roc/home/pix/out/home_test_v1/misc_bg8 The structure of the directory I've loaded them into is this: /shots/$SHOWNAME/$SHOTNAME/pix/out/$ELEMENTNAME/$RESOLUTION_$COLORSPACE I have to rename the frames in accordance with standard naming conventions. These include: 1. No capital letters in the filenames 2. No dashes allowed in the filenames 3. The images should be re-numbered so that they are a contiguous sequence (i.e. no gaps) 4. Frame numbers need to be padded to four-digits. ie, "1" becomes "0001" This is denoted by the symbol # so a range of 1-240 would read 1-240#. 5. The frames should be renamed to match the directory in which they are placed in the following manner: $ELEMENTNAME_$RESOLUTION_$COLORSPACE.#.$EXTENSION So, in other words, each frame should become: /shots/roc/home/pix/out/home_test_v1/misc_bg8/home_test_v1_misc_bg8.0001.jpg /shots/roc/home/pix/out/home_test_v1/misc_bg8/home_test_v1_misc_bg8.0002.jpg /shots/roc/home/pix/out/home_test_v1/misc_bg8/home_test_v1_misc_bg8.0003.jpg ... /shots/roc/home/pix/out/home_test_v1/misc_bg8/home_test_v1_misc_bg8.0240.jpg However, the incoming frames are part of a series and must be kept in the exact same order as they were when loaded (i.e., the incoming frame with the lowest index will map to `home_test_v1_misc_bg8.0001.jpg', while the second lowest index will map to `home_test_v1_misc_bg8.0002.jpg', and so on). Hint: sorting by name is not enough! Sample usage: $ roc_cd2spi /shots/spi/home/pix/out/home_test_v1/misc_bg8 |
|
||||
|
Quote:
![]() Try this, Code:
#! /bin/zsh typeset -l file index=1 find . -name '*.*' -print | while read file do mv $file `echo $file | sed 's/-//g'`"."$index index=$(($index + 1)) done exit 0 |
|
|||||
|
Code:
SIMPLE RULES OF THE UNIX FORUMS: (4) Do not 'bump up' questions if they are not answered promptly. No duplicate or cross-posting and do not report a post or send a private message where your goal is to get an answer more quickly. Initial thread : Move and rename files in seq. with padded digits Jean-Pierre. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|