Last active
October 7, 2021 00:13
-
-
Save kinow/8188e5a74582d3291435393c281a0133 to your computer and use it in GitHub Desktop.
Files loops
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
File1.fastq | |
File2.fastq |
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
#!/bin/bash | |
set -e | |
# https://github.com/koalaman/shellcheck/wiki/SC2013 | |
while IFS= read -r file | |
do | |
echo "Processing file ${file}" | |
[[ "${file}" =~ ^File([0-9]+).fastq$ ]] && true | |
index=${BASH_REMATCH[1]} | |
if [ -z "${index}" ] || [ "${index}" = "" ]; then | |
echo "Could not locate parameters for file ${file}!" 1>&2 | |
exit 1 | |
fi | |
params_file="parameter_list${index}.txt" | |
if [ ! -f "${params_file}" ]; then | |
echo "Parameters file ${params_file} not found!" 1>&2 | |
exit 1 | |
fi | |
echo "Parameters file ${params_file}" | |
parameters=$(head -n 1 "${params_file}") | |
command_line="blabla ${file} ${parameters}" | |
echo "Command: ${command_line}" | |
done < file_list.txt | |
echo "Bye!" | |
exit 0 |
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
1 10 100 |
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
2 20 200 |
Author
kinow
commented
Oct 7, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment