![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Rename a file name | Aswarth | Shell Programming and Scripting | 0 | 06-04-2008 03:18 PM |
| Not able to rename file | MANISH KU | Shell Programming and Scripting | 2 | 06-27-2007 05:07 AM |
| File rename | redlotus72 | UNIX for Dummies Questions & Answers | 1 | 03-09-2006 11:52 AM |
| how to rename a file before and after a ftp? | forevercalz | Shell Programming and Scripting | 2 | 10-28-2005 10:19 AM |
| Help with multiple file rename - change case of part of file name | steve7 | UNIX for Dummies Questions & Answers | 7 | 06-30-2005 02:41 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Advanced File Rename help
So, I am so new that I can't even call myself a unix user. I have an aptitude for programing, but I don't know the language. Anyway, here is my problem:
I have to rename a batch of files that look like: 2001_0001.asc 2001_0002.asc . . . 2006_0548.asc The names are a date code, but they need to be altered such that 2001_0001.asc becomes 2000_183.asc, 2001_0184 becomes 2001_001, and 2006_0548.asc becomes 2006_365.asc. so, I think it should start like: for i in `ls*` do then things get a bit hazy I will now convert to semi-programing speak split aaaa_bbbb.asc into aaaa and bbbb interpret strings aaaa and bbbb as numbers x and y respectively if y - 183 < 1, then x' = x - 1 and y' = y - 183 + 365, else x' = x and y' = y - 183. convert numbers x and y to strings aaaa' and bbb' (note the three digits in bbb such that y' = 1 will convert to bbb' = 001) rename file i to aaaa'_bbb'.asc any help would be appreciated thanks, -TT |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|