Newer
Older
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
# set -vx
# Simple script to switch to using the reduced precision input files
# Finds all 4.2_RC strings in input*.cfg files and appends _LITE.
# Repeat with the -r flag to reverse this process.
#
# This needs to be run in the SETTE directory.
#
#########################################################################################
######################### Start of function definitions #################################
##
#
reverse=0
if [ $# -gt 0 ]; then
while getopts r option; do
case $option in
r) reverse=1;;
h | *) echo ''
echo 'sette_use_LITE.sh : '
echo ' Switch to using the reduced precision, LITE input files'
echo ' [-r] :'
echo ' Switch back to using the normal 4.2_RC files'
exit 42;;
esac
done
shift $((OPTIND - 1))
fi
#
if [ $reverse == 0 ] ; then
for file in $( grep -l -e '4.2_RC\.' -e '4.2_RC$' in*cfg )
do
perl -0777 -pi -e 's@4.2_RC@4.2_RC_LITE@g' $file
done
else
for file in $( grep -l -e '4.2_RC_LITE\.' -e '4.2_RC_LITE$' in*cfg )
do
perl -0777 -pi -e 's@4.2_RC_LITE@4.2_RC@g' $file
done
fi
#
exit