Sponsored Content
Top Forums Shell Programming and Scripting How to join two different file in UNIX? Post 302873179 by rbatte1 on Monday 11th of November 2013 09:35:57 AM
Old 11-11-2013
i don't see a reference to operating system or shell, but have a look at the paste command. That may do what you are looking for.
Code:
$ cat file1
id         phenotype
100         1.2
200         -0.5
300         3.1
$ cat file2
id           genotype
100           0 1 2 ......
200           1 1 1...... 
300           2 0 0 .......
$ paste file1 file2
id         phenotype    id           genotype
100         1.2 100           0 1 2 ......
200         -0.5        200           1 1 1...... 
300         3.1 300           2 0 0 .......
$




I hope that this helps,
Robin
Liverpool/Blackburn
UK
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to join flat files together under unix

Hi, I have 7 big flat files, each contains 24 million records which have been sorted by the first field delimitered by Ctrl B (002). I want to join them together side by side, eg. File A: 1^Ba^Bb 2^Bx^By .... File B: 1^Bc^Bd 2^Bm^Bn .... After merged, it should look like :... (7 Replies)
Discussion started by: xli
7 Replies

2. UNIX for Advanced & Expert Users

unix join !

just wandering if anyone knows what kind of algorithm unix join command is using to join 2 files. Thanks! (2 Replies)
Discussion started by: strike
2 Replies

3. Shell Programming and Scripting

How can i join three lines into one in unix?

Hi all, I am trying to merge three lines into one in my unix text file. My text file sis omething like this. xxxxxxxxx yyyyyyyyyyy zzz aaaaaaaaa bbbbbb ccccc Expected out put is xxxxxxxxx yyyyyyyyyyy zzz aaaaaaaaa bbbbbb ccccc I tried with awk as shown below. (23 Replies)
Discussion started by: rdhanek
23 Replies

4. Shell Programming and Scripting

Left Join in Unix based on Key?

So I have 2 files: File 1: 111,Mike,Stipe 222,Peter,Buck 333,Mike,Mills File 2: 222,Mr,Bono 444,Mr,Edge I want output to be below, where 222 records joined and all none joined records still in output 111,Mike,Stipe 222,Peter,Buck,Mr,Bono 333,Mike,Mills 444,Mr,Edge (4 Replies)
Discussion started by: stack
4 Replies

5. Shell Programming and Scripting

Unix Join

Hi, I am trying to join two simple files but unable to do so properly. File R1 : 100 101 102 105 . . 1000 10001 File R2 100|x1 102|x2 1000|a1 10001|a2 and when i do (4 Replies)
Discussion started by: wanderingmind16
4 Replies

6. UNIX for Dummies Questions & Answers

how to join all lines in afile in unix

Hi, I have a unix file which has many lines, i need to join all the lines to single line. Eg: myfile.txt contains: a 123 45fg try and i need the output as : a 123 45fg try Please help me on this. Thanks! (2 Replies)
Discussion started by: RP09
2 Replies

7. UNIX for Dummies Questions & Answers

UNIX outer join

Hello.. I am trying to join two files of about 7000 records. it looked quite straight forward when i began, but i'm not getting the desired output. here is what i'm trying to do: cat xxx item,So,Mo,Tu aaa,1,1,1 bbb,1,1,4 ccc,1,1,0 ddd,1,1,1 cat yyy item,Tu,We aaa,1,1 bbb,4,0... (7 Replies)
Discussion started by: wanderingmind16
7 Replies

8. Shell Programming and Scripting

Comparing two files in UNIX and create a new file similar to equi join

I have 2 files namely branch.txt file & RXD.txt file as below Ex:Branch.txt ========================= B1,Branchname1,city,country B2,Branchname2,city,country B3,Branchname3,city,country B4,Branchname4,city,country B5,Branchname5,city,country RXD file : will... (11 Replies)
Discussion started by: satece
11 Replies

9. Shell Programming and Scripting

How to join one file with multiple files in a directory in UNIX?

Dear folks Hello I have a one file called (file1) which the structure looks like this 1 gi|358484521|ref|NW_003764373.1| 1 gi|358484520|ref|NW_003764374.1| 1 gi|358484519|ref|NW_003764375.1| . . . 30 gi|368484519|ref|NW_00449375.1| In addition, I have around 300... (19 Replies)
Discussion started by: sajmar
19 Replies

10. Shell Programming and Scripting

UNIX Join not working as expected

Hello All, I'm working on a Shell script to join data from two files using Join command but not able to get the desired output as its throwing me an error: I have sorted the two files on the Column 1 numerically which is used as Join clause File 1: 1,ABC,GGG,20160401 2,XYZ,KKK,20160401... (2 Replies)
Discussion started by: venkat_reddy
2 Replies
IMAGEPOLYGON(3) 							 1							   IMAGEPOLYGON(3)

imagepolygon - Draws a polygon

SYNOPSIS
bool imagepolygon (resource $image, array $points, int $num_points, int $color) DESCRIPTION
imagepolygon(3) creates a polygon in the given $image. PARAMETERS
o $ image -An image resource, returned by one of the image creation functions, such as imagecreatetruecolor(3). o $points - An array containing the polygon's vertices, e.g.: +----------+------+ |points[0] | | | | | | | = x0 | | | | |points[1] | | | | | | | = y0 | | | | |points[2] | | | | | | | = x1 | | | | |points[3] | | | | | | | = y1 | | | | +----------+------+ o $num_points - Total number of points (vertices). o $color - A color identifier created with imagecolorallocate(3). RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 imagepolygon(3) example <?php // Create a blank image $image = imagecreatetruecolor(400, 300); // Allocate a color for the polygon $col_poly = imagecolorallocate($image, 255, 255, 255); // Draw the polygon imagepolygon($image, array( 0, 0, 100, 200, 300, 200 ), 3, $col_poly); // Output the picture to the browser header('Content-type: image/png'); imagepng($image); imagedestroy($image); ?> The above example will output something similar to:[NOT DISPLAYABLE MEDIA]Output of example : imagepolygon() SEE ALSO
imagecreate(3), imagecreatetruecolor(3). PHP Documentation Group IMAGEPOLYGON(3)
All times are GMT -4. The time now is 10:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy