Created
October 4, 2022 19:52
-
-
Save w4tson/2109ab7ee2b3619db7acb7b7b5c86ea0 to your computer and use it in GitHub Desktop.
A little test of bash hashmaps, dynamic arrays etc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dir_mappings() { | |
case $1 in | |
'ABC_DET') echo 'ABC_DET';; | |
'DDD_DET') echo 'DDD_DET';; | |
'ZZZ_DET') echo 'ZZZ_DET';; | |
'ZZZ_1') echo 'ZZZ_DET';; | |
'ZZZ_2') echo 'ZZZ_DET';; | |
'ZZZ_3') echo 'ZZZ_DET';; | |
*) echo 'nope';; | |
esac | |
} | |
batches=() | |
for folder in `find ./FILES/svc/* -type d` | |
do | |
dataset=`echo "$folder" | sed 's|.*/||'` | |
echo "processing $dataset" | |
for filepath in `find ./FILES -name "$dataset*.dmp"` | |
do | |
file=`sed 's|.*/||' <<< $filepath` | |
batch=`sed 's/\(.*\)_[0-9]\{2\}\.dmp/\1/' <<< $file` | |
batches+=($batch) | |
done | |
done | |
unique_batches=`echo "${batches[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' '` | |
for b in $unique_batches | |
do | |
echo $b | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment