I have multiple .txt files in my folder " Subj1 " arranged in following format
regional_vol_GM_atlas1.txt regional_vol_GM_atlas1_prop.txt .... regional_vol_GM_atlas152.txt
each file consists of data in following format
667869 667869 580083 580083 316133 316133 11398.1 11398.1
i would like to export the data along with associated file name in text file to csv file.
I have written a code for that
#!/bin/bash for x in regional_vol*.txt; do /bin/echo -n -e "$x\t" done paste regional_vol*.txt >> final_table.csv
which pastes the data in each file into csv file,the sample output image looks like this ,
but in the output i would like to obtain associated file name as a header for the data how could i change my code to obtain such output ?
This is the sample example of output i expect