Mercurial > bins
comparison tools/remove_num_prefix @ 0:a84c32f131df 1.1.29
Import vendor version
author | Peter Gervai <grin@grin.hu> |
---|---|
date | Wed, 15 Oct 2008 23:28:56 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:a84c32f131df |
---|---|
1 #!/bin/sh | |
2 | |
3 # Remove a numeric prefix (ex 0010_filename -> filename) on files | |
4 | |
5 # (c) 2005 Jérôme SAUTRET <jerome@sautret.org> | |
6 # This script is distributed under GNU GPL. Ask Stallman for details. | |
7 | |
8 # $Id: remove_num_prefix,v 1.1 2005/08/22 19:58:27 jerome Exp $ | |
9 | |
10 set -o errexit | |
11 if [ -z "$1" ] ; then | |
12 cat <<EoF | |
13 Usage: | |
14 `basename $0` files... | |
15 Remove a numeric prefix (ex 0010_filename -> filename) on files. | |
16 EoF | |
17 exit 1 | |
18 fi | |
19 | |
20 | |
21 files="$@" | |
22 | |
23 | |
24 i=$min | |
25 for file in $files | |
26 do | |
27 new="`echo "$file" | sed 's/^0*[0-9][0-9]*_\(.*\)$/\1/'`" | |
28 echo "$file -> $new" | |
29 mv "$file" "$new" | |
30 done |