|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | 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. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
remove certain part of file name
Hi,
Is it possible to remove the first part of the file name using find. i.e i have something like 2006abc.txt , 1007bed.txt etc, I wanna rename them to abc.txt , bed.txt I tried some stupid way.. find . -name '*.txt' -exec mv {} `cut -f2-5 -d"_" {}` \; somehow iam not getting it. appreciate any help. |
| Sponsored Links |
|
|
|
|||
|
Code:
find . -maxdepth 1 -name '*.txt' -print -exec echo "mv {} \`echo {} | sed 's/[^a-z.]//g'\`" \; | zsh |
| Sponsored Links |
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| cut a part of the file | kurosaki | Shell Programming and Scripting | 1 | 06-02-2008 10:14 AM |
| remove part of a line | tiger99 | Shell Programming and Scripting | 16 | 02-06-2008 08:29 AM |
| Remove part of the file | chiru_h | Shell Programming and Scripting | 10 | 08-22-2007 05:15 PM |
| How do I take out(remove) the date part in the file name? | ruthless | HP-UX | 5 | 02-06-2006 01:32 PM |
| 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 |