Hello GNU/Linux newbie here.
I want to write two variables in a two-columns tab-separated file. In my code, the variables are $sample_name
and $file
.
I use the commands:
touch
to create the file andecho -e $sample_name $file | column -t >> $output_file
to write each line. Although this results in an one-column file.
Any ideas?
Simplified script:
touch $output_file
for file in $path/*.g.vcf; do
sample_name=`echo $file | grep -P 'HG(\d+)(?=.g)' -o`
echo -e $sample_name $file | column -t >> $output_file
done
Expected output (viewing the output file):
HG00321 ./.../HG00321/HG00321.g.vcf
HG00322 ./.../HG00322/HG00322.g.vcf
# and so on