Sponsored Content
Top Forums Shell Programming and Scripting Merging data from one file into another Post 302563902 by birkhe on Wednesday 12th of October 2011 11:27:41 AM
Old 10-12-2011
hi Skrynesaver. Since your post was so helpful to gimley, I was wondering if you would be kind enough to help me out. I have three files each with a few columns. I want to merge them and produce an output file as shown below. I would really appreciate any help you could provide. Thanks so much.


File1
chromo pos ref refFreq altAllele altFreq
chr1 55 T 0.2 C 0.8
chr1 57 C 0.8 A 0.2
chr1 60 C 0.8 A 0.2
chr2 62 T 0.2 C 0.8
chr2 67 C 0.8 A 0.2
chr2 96 T 0.2 C 0.8
chr2 100 C 0.8 A 0.2
chr3 32 T 0.2 C 0.8

File2
chromo pos ref refFreq altAllele altFreq
chr1 55 T 0.4 C 0.6
chr1 57 C 0.7 A 0.3
chr1 96 G 0.5 A 0.5
chr2 62 T 0.15 C 0.85
chr2 67 C 0.5 A 0.5
chr2 100 C 0.8 A 0.2
chr4 32 G 0.2 C 0.8

File3
chromo pos ref refFreq altAllele altFreq
chr1 27 C 0.7 A 0.3
chr1 55 T 0.4 C 0.6
chr1 57 C 0.7 A 0.3
chr2 62 T 0.15 C 0.85
chr2 67 C 0.5 A 0.5
chr2 100 C 0.8 A 0.2
chr4 32 G 0.2 C 0.8

OutputFile
chromo pos ref F1.refFreq F1.altAllele F1.altFreq F2.refFreq F2.altAllele F2.altFreq F3.refFreq F3.altAllele F3.altFreq
chr1 27 C NA NA NA NA NA NA 0.7 A 0.3
chr1 55 T 0.2 C 0.8 0.4 C 0.6 0.4 C 0.6
chr1 57 C 0.8 A 0.2 0.7 A 0.3 0.7 A 0.3
chr1 60 C 0.8 A 0.2 NA NA NA NA NA NA
chr1 96 G NA NA NA 0.5 A 0.5 NA NA NA
chr2 62 T 0.2 C 0.8 0.15 C 0.85 0.15 C 0.85
chr2 67 C 0.8 A 0.2 0.5 A 0.5 0.5 A 0.5
chr2 96 T 0.2 C 0.8 NA NA NA NA NA NA
chr2 100 C 0.8 A 0.2 0.8 A 0.2 0.8 A 0.2
chr3 32 T 0.2 C 0.8 NA NA NA NA NA NA
chr4 32 G NA NA NA 0.2 C 0.8 0.2 C 0.8
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Merging data

Hi, I have the following problem: Input: "num1","num2","num3",num4,num5,"num6" required output: "num1num2","num3",num4,num5,"num6" I need to join field 1 and field 2 together but I always end up getting: "num1""num2","num3",num4,num5,"num6" Note that not all fields have " at both... (8 Replies)
Discussion started by: ReV
8 Replies

2. Shell Programming and Scripting

Need help for 2 data file merging

Hello Please help me to write Shell script. I want to merge 2 data files . The data files have common columns The data file A have 3 columns Host Version Numberof Failuers The data file B have also 3 coulmns Host Version NumberofFailuers . I want to merge A and B file... (2 Replies)
Discussion started by: getdpg
2 Replies

3. Shell Programming and Scripting

merging CSV data using a one liner from shell?

I'm trying to merge multiple CSV (comma separated value) files into one large master file. All files have a field that is unique to act as the key for entry/merging into the master file & and all files have the same number of fields that are in the master file. I'll give an example here: ... (2 Replies)
Discussion started by: jjinca
2 Replies

4. Shell Programming and Scripting

Merging last and syslog data on time

This is on a HP-UX system. I need to merge the 2 reports, for each line in syslog I need to lookup who was logged in to the pts/# based on the time from the last.txt report. Here is what I get from sulog.log cat syslog | grep "su:" | grep "Jun 14" Jul 14 08:02:48 server1 su: - 2 ... (8 Replies)
Discussion started by: Ikon
8 Replies

5. Shell Programming and Scripting

Removing Carriage return and merging data

Hi, I am trying to remove the carriage return on the record which starts with ADD, MODIFY, or DELETE keyword as the first value in the record. If the records does not start with anyone of these keywords then combine the records with the previous record (line). Input File name xyz.txt... (6 Replies)
Discussion started by: naveed
6 Replies

6. Shell Programming and Scripting

formatting and merging 2 data files

Hi, I have 2 files that I got as an output from another program. They are : File 1 ((((((CtBJa:197.0,CtBTz:197.0):85.0,CtAHr:197.0):116.0,CtDUw:197.0):176.0,CtSwe:197.0):110.0, (CtL2b:197.0,Ct4Bu:197.0):196.0):197.0,CmuNg:197.0);... (5 Replies)
Discussion started by: Lucky Ali
5 Replies

7. Shell Programming and Scripting

Merging data from 2 files of different lengths?

Hi all, Sorry if someone has answered something like this already, but I have a problem. I am not brilliant with "awk" but think it should be the command to use to get what I am after. I have 2 files: job-file (several hundred lines like): 1018003,LONG MU WAN,1113S 1018004,LONG MU... (4 Replies)
Discussion started by: sgb2301
4 Replies

8. UNIX for Dummies Questions & Answers

Merging data in a file

Hello, Firstly I just wanted to say that I'm not a programmer at all and appreciate any help you can give. I am trying to create a shellscript that reformats the file and adding up colums 5 and 6 for those sections that are continuation of the previous line(s) (signified by beginning with '*')... (4 Replies)
Discussion started by: neilh1703
4 Replies

9. Shell Programming and Scripting

Help with merging data into single line.

Hi, My input is <message> looking for a big <message>Does fit my G74 laptop. Makes the 10 pound. <message> <message>This bag is the only one I could find to fit my awesome ASUS G74S. <message> <message> Great bag my only wish is that they had put a pocket in which to store and... (6 Replies)
Discussion started by: pamu
6 Replies

10. Shell Programming and Scripting

Merging data horizontally with newlines in files

Hi Everyone, I have two files file1 and file2 with these contents cat file1 AAAAA 01/03/2014 04:01:23 BBBB 01/03/2014 03:03:34 CCCcc 01/03/2014 03:03:34 cat file2 1 RED 1 HHHH 1 TTTT 1 BBBBB I tried the below... (2 Replies)
Discussion started by: Aditya_001
2 Replies
DEBCONF-GETLANG(1)						      Debconf							DEBCONF-GETLANG(1)

NAME
debconf-getlang - extract a language from a templates file SYNOPSIS
debconf-getlang lang master [translation] debconf-getlang --stats master translation [...] DESCRIPTION
Note: This utility is deprecated; you should switch to using the po-debconf package. This program helps make and manage translations of debconf templates. There are basically three situations in which this program might be called: A translation is just being started. You want to provide the translator with a file they can work on that has the English fields from your templates file, plus blank Field- ll fields for the target language that they can fill in. To do this, run the program with first parameter being the code for the language that is being translated to, and the second parameter being the filename of the English templates file. A translation is well under way. You have changed some English text, or added more items to your templates file, and you want to send the translators a file with the English text plus their current translations (or you are the translator, and you want to generate such a file for your own use). To accomplish this, run the program with the first parameter being the the code for the language that is being translated to, the second parameter being the filename of the master English templates file, and the third parameter being the filename of the current translated file. When run this way, the program is smart enough to notice fuzzy translations. For example a fuzzy Description will be output as Description-<lang>-fuzzy, and a new, blank Description-<lang> will be added. Translators should remove the -fuzzy fields as they correct the fuzzy translations. Checking the status of a translation To check the status of a translation, use the --status flag, and pass the english template file as the first parameter, and all the other translated templates after that. It will output statistics for each of them. For example: debconf-getlang --stats debian/templates debian/templates.* NOTE
Note that the text in the generated templates may be word-wrapped by debconf. SEE ALSO
debconf-mergetemplate(1) AUTHOR
Joey Hess <joeyh@debian.org> 2012-09-10 DEBCONF-GETLANG(1)
All times are GMT -4. The time now is 04:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy