Merging two files based on two columns to make a third file
Hi there,
I'm trying to merge two files and make a third file.
However, two of the columns need to match exactly in both files AND I want everything from both files in the output if the two columns match in that row.
First file looks like this:
Second file looks like this:
I need column 1 and 2 in file 1 to match column 2 and 4 in file 2, respectively.
Any help you can provide is very much appreciated.
I've tried using the join function and awk, but I've failed miserably at both.
Thank you.
Moderator's Comments:
Please use code tags when posting data and code samples!
Last edited by vgersh99; 04-26-2011 at 06:00 PM..
Reason: code tags, please!
hi
i need to select a few columns of two txt files and write it to a new file. there is one common field for both of these files.
plz help me in this
thanks in advance (4 Replies)
Hi,
I want to select columns from multiple files and combine them in one file. The files are simulation-data-files with 23 columns each and about 50 rows. I now use:
cut -f 11 Sweep?wing-30?scale=0.?0?fan2?.txt | pr -3 | awk '{printf("\n%s\t%s\t%s",$1,$2,$3)}' > ../Data_Processed/output.txtI... (1 Reply)
Hi ,
I have a typical situation. I have 4 files and with different headers (number of headers is varible ).
I need to make such a merged file which will have headers combined from all files (comman coluns should appear once only).
For example -
File 1
H1|H2|H3|H4
11|12|13|14
21|22|23|23... (1 Reply)
Hello,
I have a number of tab delimited data files consists of two columns. Like that:
File1
800.000000 0.002744
799.000000 0.002517
798.000000 0.002836
797.000000 0.002553
FIle2
800.000000 0.000261
799.000000 0.000001
798.000000 0.000551
797.000000 0.000275
File3... (19 Replies)
Hi,
I have two text files that I would like to merge/join. I would like to join them if the first columns of both text files match and the second column of the first text file matches the third column of the second text file.
Example input:
First file:
1334 10 0 0 1 5.2
1334 12 0 0 1 4.5... (4 Replies)
Respected Members.
Hello.
This is my first post in the forum. I will try to follow all the rules as prescribed by the forum. In case of non-compliance, I request you to kindly give me some more time to understand and abide by them.
I am working on two files. I wish to merge the two files... (1 Reply)
Respected Members.
Hello.
This is my first post in the forum. I will try to follow all the rules as prescribed by the forum. In case of non-compliance, I request you to kindly give me some more time to understand and abide by them.
I am working on two files. I wish to merge the two files... (6 Replies)
Hello,
I have some tab delimited text files with a three header rows. The headers look like, (sorry the tabs look so messy).
index group Name input input input input input input input input input input input... (9 Replies)
Hi,
I am facing issues while accomplishing below task.
We have two files Test1.txt and Test2.txt. We have to match 1st column of Test1.txt file with 2nd column of Test2.txt and then merge 2nd file with the 1st file. In the output we should select column 1 and 2 from the 1st file and column 1... (5 Replies)
Discussion started by: Prathmesh
5 Replies
LEARN ABOUT REDHAT
dadadodo
dadadodo(1) General Commands Manual dadadodo(1)NAME
dadadodo - exterminate all rational thought
SYNOPSIS
dadadodo [ options ] [ input-files ]
DESCRIPTION
dadadodo is a program that analyses texts for Markov chains of word probabilities and then generates random sentences based on those proba-
bilities. Sometimes these sentences are nonsense, but sometimes they cut right through to the heart of the matter and reveal hidden mean-
ings.
OPTIONS
dadadodo accepts the following options:
-c, -count n
Generate n sentences.
-h, -help
Show summary of options and exit.
-html Output HTML instead of plain text.
-l, -load file
Load compiled data from file ('-' for standard input).
-o, -output file
Save compiled data in file ('-' for standard output).
-p, -pause s
Delay s seconds between paragraphs.
-w, -columns columns
Format output for a device columns character cells in width. If not specified, the value of the environment variable COLUMNS is
used to determine the width. If that variable is not defined, a width of 72 is assumed.
NOTES
Non-option arguments are input files. These should be text files, but may be mail folders or HTML. MIME messages are handled sensibly.
When no output file is specified, sentences will be generated from the input data directly. However, loading a saved file is far faster
than re-parsing the text files each time.
ENVIRONMENT
COLUMNS
Determines the width (in character cells) of the output if the -w, -columns option is not used. If not set, a width of 72 is
assumed.
SEE ALSO
dadadodo's upstream website is http://www.jwz.org/dadadodo/.
AUTHOR
dadadodo was written by Jamie Zawinski.
This manual page was written by Sudhakar Chandrasekharan <thaths@netscape.com>, based on the program's usage message.
dadadodo(1)