source: SH_SHM/trunk/util/string_replace.csh @ 92

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
11if  ("$3" == "")  then
12        echo "Usage: $0 <wildcard> <search> <replace>"
13        exit
14endif
15
16set wild="$1"
17set search="$2"
18set repl="$3"
19
20set flist=`ls $wild`
21foreach 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
26end
Note: See TracBrowser for help on using the repository browser.