added a bash script to rename old fsu file

This commit is contained in:
splitPoleDAQ 2024-01-11 17:56:55 -05:00
parent ea2bf2cb01
commit 0686ad67e6

30
Aux/rename_oldFSU.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage: $0 file_pattern"
echo "example:"
echo " $0 \"test_002*.fsu\""
exit 1
fi
file_pattern="$1"
# Iterate through each file in the directory
for file in ${file_pattern}; do
echo ${file}
if [[ $file == *QDC* ]]; then
# Insert "16" before the last underscore
new_name="${file%_*}_16_${file##*_}"
else
# Insert "4" before the last underscore
new_name="${file%_*}_4_${file##*_}"
fi
# Rename the file
mv -iv "$file" "$new_name"
echo "Renamed: $file to $new_name"
done