Revision 16,
418 bytes
checked in by marcus, 15 years ago
(diff) |
r1 | svn | 2007-12-13 11:10:29 +0100 (Do, 13 Dez 2007) | 2 lines
Initial import
|
-
Property svn:executable set to
*
|
Line | |
---|
1 | #! /bin/csh |
---|
2 | # |
---|
3 | # file string_replace.csh |
---|
4 | # ================== |
---|
5 | # |
---|
6 | # version 1, 21-May-2006 |
---|
7 | # |
---|
8 | # Replace strings in a set of files |
---|
9 | # K. Stammler, 21-May-2006 |
---|
10 | |
---|
11 | if ("$3" == "") then |
---|
12 | echo "Usage: $0 <wildcard> <search> <replace>" |
---|
13 | exit |
---|
14 | endif |
---|
15 | |
---|
16 | set wild="$1" |
---|
17 | set search="$2" |
---|
18 | set repl="$3" |
---|
19 | |
---|
20 | set flist=`ls $wild` |
---|
21 | foreach f ($flist) |
---|
22 | if (-e $f.tmp) \rm $f.tmp |
---|
23 | sed "s/$search/$repl/" $f >$f.tmp |
---|
24 | \rm $f |
---|
25 | mv $f.tmp $f |
---|
26 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.