10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-14 18:13:51 +01:00
QuantumPackage/scripts/utility/qp_clean_source_files.sh

41 lines
701 B
Bash
Raw Normal View History

2020-03-31 18:40:20 +02:00
#!/bin/bash
#
# Cleans the source files from non-ascii characters
#
# Tue Mar 31 18:28:42 CEST 2020
#
function help() {
cat << EOF
Cleans the source files of QP from non-ascii characters.
Usage:
$(basename $0) [-h|--help]
Options:
-h --help Prints the help message
EOF
exit 0
}
# Check the QP_ROOT directory
if [[ -z ${QP_ROOT} ]] ; then
echo "The QP_ROOT environment variable is not set."
echo "Please reload the quantum_package.rc file."
exit 1
fi
2020-03-31 19:02:03 +02:00
FILES=$(grep -e "[\x{00FF}-\x{FFFF}]" ${QP_ROOT}/src/*/*.f | cut -d ':' -f 1 | sort | uniq)
2020-03-31 18:40:20 +02:00
for F in $FILES ; do
echo "Cleaning $F"
2020-03-31 19:02:03 +02:00
# vim -c "% s/\%xA0/ /g" -c ":wq" $F
perl -pi -e 's/[^[:ascii:]]/ /g' $F
2020-03-31 18:40:20 +02:00
done
2020-03-31 19:02:03 +02:00