blob: e0f0ee6aad88fc95a84a261aa61ae5bc7ddd4fe5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/bin/bash
# Script to automatically replace patterns in all source files
# Example usage
# (in main directory colobot):
# $ tools/sed-replace.sh src/app/d3dengine.cpp ...
# $ tools/sed-replace.sh `find . -name '*.cpp' -o -name '*.h'`
# List of sed commands (replacements)
replacements=( \
's/\bD3DVECTOR\b/Math::Vector/g' \
's/\bD3DMATRIX\b/Math::Matrix/g' \
)
# Loop over arguments
for file in "$@"; do
# Loop over replacements
for what in "${replacements[@]}"; do
sed -i "$what" "$file"
done
echo "$file"
done
|