![]() |
|
|
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 |
| changing scripts in /etc/rc2.d | rkruck | UNIX for Dummies Questions & Answers | 1 | 10-15-2008 01:34 PM |
| awk is changing my FS !! | jolecanard | Shell Programming and Scripting | 4 | 10-04-2008 07:09 AM |
| changing date | manoj.solaris | Linux | 1 | 09-12-2007 05:27 PM |
| Changing userID and Changing group and GID | deal732 | Shell Programming and Scripting | 2 | 04-18-2007 11:09 AM |
| Changing IP's | Hordak | UNIX for Dummies Questions & Answers | 2 | 08-03-2002 01:42 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
(find . -type f | while read i) Deleting Dates
Hi all, I currently use this code to delete text from file names when they are dropped in a folder. Code:
find . -type f | while read i;do [ "$i" != "${i//2009abc/}" ] && mv "$i" "${i//2009abc/}" ;done
I have four versions of the code that delete the unwanted text if it has 2006, 2007, 2008 and 2009 with other standard text in it in four different folders. Is there a way that I could re-write the code so that for argument sake delete any date from say 1990 to 2009 with and any date before that leave it in. For example; HTML Code:
Input: name of file 2009 abc.mov Output: name of file.mov HTML Code:
Input: name of file 2008 abc.mov Output: name of file.mov HTML Code:
Input: name of file 2007 abc.mov Output: name of file.mov HTML Code:
Input: name of file 2006 abc.mov Output: name of file.mov HTML Code:
Input: name of file 1987 abc.mov Output: name of file 1987.mov Thanks in advance
Last edited by Monkey Dean; 05-06-2009 at 06:33 AM.. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|