Entering edit mode
2.5 years ago
genomes_and_MGEs
▴
10
Hi there,
I have multiple comma-separated files named A.txt, B.txt, ... with the following structure for A.txt:
> ,detected_genes,mean_abund,mean_abund_nz,median_abund,median_abund_nz
> H02_1,0.8377591851582393,3.2743554431006854,3.60999928151245,3.1628119732276407,3.680581204295978
> H15_2,0.9223946784922394,3.9074020797919604,3.8968716734150335,3.9540308755266276,4.182691920839667
> H17_1,0.8480243161094225,4.570136920313126,4.6683507760942895,4.374416758288309,4.497115788409282
My goal is to add a new column at the end of each row (except the header), with the filename of each file, so that it shows
> ,detected_genes,mean_abund,mean_abund_nz,median_abund,median_abund_nz
> H02_1,0.8377591851582393,3.2743554431006854,3.60999928151245,3.1628119732276407,3.680581204295978,A
> H15_2,0.9223946784922394,3.9074020797919604,3.8968716734150335,3.9540308755266276,4.182691920839667,A
> H17_1,0.8480243161094225,4.570136920313126,4.6683507760942895,4.374416758288309,4.497115788409282,A
Can someone help me out? Thanks!
I guess it should be:
or