-
Notifications
You must be signed in to change notification settings - Fork 2
/
clean-up.sh
27 lines (18 loc) · 963 Bytes
/
clean-up.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
## remove multiple blank lines
find stan -name *.hpp -exec perl -0777 -pi -e 's/\n\n\n/\n\n/igs' {} \;
## remove space between namespace stan and next namespace
find stan -name *.hpp -exec perl -0777 -pi -e 's/namespace stan {\n\n namespace/namespace stan {\n namespace/igs' {} \;
## remove "using stan::math::*;" statements
find stan -name *.hpp -exec perl -0777 -pi -e '/using stan::math::/d' {} \;
find stan -name *.hpp -exec sed -i '' '/using stan::math::/d' {} \;
## removing "stan::math::" from statements
find stan -name *.hpp -exec sed -i '' 's/stan::math:://' {} \;
## search through these files to remove end-of-namespace comments
grep -r '} //' stan
## search through these files to remove 'const double&' arguments
grep -rl 'const double&' stan
## search through these files to remove 'const int&' arguments
grep -rl 'const int&' stan
## search through these files to change leading underscores to trailing
grep -rl ' _' stan