The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 05-06-2009
Monkey Dean Monkey Dean is offline
Registered User
  
 

Join Date: May 2009
Posts: 15
(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
Is this possible?

Thanks in advance

Last edited by Monkey Dean; 05-06-2009 at 06:33 AM..
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0