[go: up one dir, main page]

File: sed-replace.sh

package info (click to toggle)
colobot 0.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 415,516 kB
  • sloc: cpp: 129,242; ansic: 8,872; python: 2,158; sh: 672; awk: 91; xml: 35; makefile: 31
file content (22 lines) | stat: -rwxr-xr-x 523 bytes parent folder | download | duplicates (10)
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