LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Combine complicate files (https://www.linuxquestions.org/questions/linux-newbie-8/combine-complicate-files-856830/)

Sampaio 01-17-2011 08:45 AM

Combine complicate files
 
Hi,

I would like to combine several txt files. I want to append after each line the name of the file and the information that is before "--" in the text file.

The information before "--" is the name of the analyzed group and from each of this group I need to extract the collumns DIST,CHR, BP and P.

Bellow is a short example of one file:

--begin of the file--

7A5 -- chr7:20090803..20273538 ( 182.735kb ) including 50kb border

DIST CHR SNP BP NMISS BETA SE R2 T P
92.92kb 7 rs10233571 20233727 1259 0.08996 0.04159 0.003708 2.163 0.03073


A1CF -- chr10:52186330..52365441 ( 179.111kb ) including 50kb border

DIST CHR SNP BP NMISS BETA SE R2 T P
-41.54kb 10 rs56058931 52194789 1257 -0.1114 0.04468 0.004926 -2.492 0.01282
46.34kb 10 rs12769066 52282668 1264 0.07943 0.03885 0.003302 2.045 0.04109
67.14kb 10 rs4317935 52303465 1265 0.08394 0.03877 0.003698 2.165 0.03057


--end of the file--

I hope you can help me.

Thanks in advance!!!

grail 01-17-2011 09:26 AM

So what have you tried so far?

Sampaio 01-19-2011 05:50 AM

Dear Grail,

Thanks for your help. I decided to use perl and test another program with a more friendly output.

See you next time!


All times are GMT -5. The time now is 02:25 PM.