Created
October 30, 2023 23:56
-
-
Save msoutopico/72cee9a221860fedb9f876372ffc8e80 to your computer and use it in GitHub Desktop.
add_file_to_batch.sh
This file contains 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
#!/usr/bin/env bash | |
source_dir="/home/souto/Repos/ACER-PISA-2025-FT/pisa_2025ft_translation_common/source" | |
root="$source_dir/batch1" | |
config="$source_dir/files.yaml" | |
# cd $root | |
batches="$(yq -r 'keys | .[]' $config)" | |
for filepath in $(find $root -type f -name "*.xml") | |
do | |
# echo "### $filepath ###" | |
filename="$(basename -- $filepath)" | |
batch=$(FILE=$filename yq '.. | select(. == env(FILE)) | parent | key' $config) | |
# [[ "$batch" == "04_QQS_N" ]] && echo "$batch: $filename" | |
# if [[ "$batches" == *"$batch"* ]] && [[ "$batch" != "" ]]; then | |
if [[ ${batches[@]} =~ $batch ]] && [[ "$batch" != "" ]]; then | |
echo "$batch;$filename" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment