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
# add headers | |
echo "sample,read1,read2" > input_samplesheet.csv | |
for read1 in $(ls path/to/directories{1,2,3}/fastq/*_1.{fastq.gz,fq,fq.gz}); | |
do | |
# get the basename of file and remove suffix | |
sample_id=$(echo $read1 | xargs -n 1 basename -s '_1.fastq.gz') | |
# replace string '_1' for '_2' | |
read2="${read1/_1/_2}" | |
# write in a new line for each sample |
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
LINES=100 | |
INPUT_FILE='PATH/TO/TEXT/CSV' | |
tail -n +2 $INPUT_FILE | split -l $LINES - prefix_ | |
for file in prefix_* | |
do | |
head -n 1 $INPUT_FILE > tmp_file | |
cat $file >> tmp_file | |
mv -f tmp_file $file |