OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [tools/] [replace_words] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
#!/bin/bash
2
 
3
original=(a b c d)
4
replacement=(w x y z)
5
 
6
# Test that we have both arguments
7
if [ -z "$1" ]; then
8
        echo Usage: replace_words DIRNAME ORIGINAL REPLACEMENT
9
        exit
10
fi
11
 
12
for ((i=0;i<1;i++));
13
do
14
 
15
        #orig=${original[$i]}
16
        #repl=${replacement[$i]}
17
        orig=$2
18
        repl=$3
19
        for filename in `find $1 -name '*.[ch]'`
20
        do
21
                echo Replacing $orig with $repl in $filename
22
                sed -i -e "s/$orig/$repl/g" $filename
23
        done
24
done

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.