annotate tools/remove_num_prefix @ 10:f962189bab94

Added tag 1.1.29.e2 for changeset 0f248ad86f9f
author Peter Gervai <grin@grin.hu>
date Thu, 16 Oct 2008 00:16:50 +0200
parents a84c32f131df
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
1 #!/bin/sh
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
2
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
3 # Remove a numeric prefix (ex 0010_filename -> filename) on files
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
4
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
5 # (c) 2005 J?r?me SAUTRET <jerome@sautret.org>
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
6 # This script is distributed under GNU GPL. Ask Stallman for details.
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
7
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
8 # $Id: remove_num_prefix,v 1.1 2005/08/22 19:58:27 jerome Exp $
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
9
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
10 set -o errexit
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
11 if [ -z "$1" ] ; then
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
12 cat <<EoF
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
13 Usage:
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
14 `basename $0` files...
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
15 Remove a numeric prefix (ex 0010_filename -> filename) on files.
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
16 EoF
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
17 exit 1
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
18 fi
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
19
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
20
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
21 files="$@"
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
22
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
23
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
24 i=$min
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
25 for file in $files
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
26 do
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
27 new="`echo "$file" | sed 's/^0*[0-9][0-9]*_\(.*\)$/\1/'`"
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
28 echo "$file -> $new"
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
29 mv "$file" "$new"
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
30 done