Overview
Comment:Changed regexp again. Fixes problem with name starting at beginning of line
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: bfb05964ffe8e8fcb9cff8a505e9103c3531568104b85baa4fdf7c2702127385
User & Date: gawthrop@users.sourceforge.net on 2002-04-22 08:28:46
Other Links: branch diff | manifest | tags
Context
2002-04-22
10:25:47
Handles unnamed components & ingnores artwork check-in: 900a60e271 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
08:28:46
Changed regexp again. Fixes problem with name starting at beginning of line check-in: bfb05964ff user: gawthrop@users.sourceforge.net tags: origin/master, trunk
08:05:26
New regexp. check-in: b3dc696bde user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/mtt_rename from [3a5380cfd9] to [f11f51dae2].

10
11
12
13
14
15
16



17
18
19
20
21
22
23
# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$



## Revision 1.5  2000/12/27 13:11:42  peterg
## *** empty log message ***
##
## Revision 1.4  1998/08/15 13:50:22  peterg
## Doesn't zap preexisting files
##
## Revision 1.3  1998/08/14 15:37:38  peterg







>
>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.6  2002/04/22 08:05:26  gawthrop
## New regexp.
##
## Revision 1.5  2000/12/27 13:11:42  peterg
## *** empty log message ***
##
## Revision 1.4  1998/08/15 13:50:22  peterg
## Doesn't zap preexisting files
##
## Revision 1.3  1998/08/14 15:37:38  peterg
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

47


48
49
50
51
#
###############################################################

old_name=$1
new_name=$2
extension=$3

left='[^a-zA-Z]*'
right=$left
if [ -f "$new_name$extension" ]; then
   echo  "$new_name$extension already exists -- no action taken"
   exit
fi
if ls $old_name$extension > /dev/null 2>&1 
    then
	echo Renaming $old_name$extension to $new_name$extension

	sed "s/\($left\)$old_name\($right\)/\1$new_name\2/g" <$old_name$extension >$new_name$extension


fi










|








>
|
>
>




34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#
###############################################################

old_name=$1
new_name=$2
extension=$3

left='[^a-zA-Z]'
right=$left
if [ -f "$new_name$extension" ]; then
   echo  "$new_name$extension already exists -- no action taken"
   exit
fi
if ls $old_name$extension > /dev/null 2>&1 
    then
	echo Renaming $old_name$extension to $new_name$extension
	sed \
         -e "s/\($left\)$old_name\($right\)/\1$new_name\2/g" \
         -e "s/^$old_name\($right\)/$new_name\1/g" \
        <$old_name$extension >$new_name$extension
fi




MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]