there multiple tab delimited text files in 1 directory contain same string in file name: “cnv_data.txt” combine these files horizontally. part of perl script. number of rows , columns same in each file (11 columns , 52 rows). here example of desired output like:
file0ne_cnv_data.txt sampleid: sample1 chrom pos func1.gene chr1 11174372 mtor filetwo_cnv_data.txt sampleid: sample2 chrom pos func1.gene chr2 1608066 mycn combined_cnv_data.txt sampleid: sample1 sampleid: sample2 chrom pos func1.gene chrom pos func1.gene chr1 11174372 mtor chr1 65310459 jak1
i’ve tried:
my $cmd23 = `paste *final_cnv_data.txt >> $combined_cnv`; print $cmd23;
and also:
my $cmd23 = `cat *final_cnv_data.txt >> $combined_cnv`; print $cmd23;
but final file blank.
is there way accomplish i'm looking for?
thanks
check paste command
paste --help paste $file1 file2 > $file3
or if want combine files sufix can do
paste sufix* >> my_new_file.txt
edit
#!/usr/bin/perl $cmd23 = `paste /tmp/temp/fichero*`; print $cmd23;
pd: if want print not redirect file
Comments
Post a Comment