Sponsored Content
Top Forums Shell Programming and Scripting how to combine 2 files by join Post 302310851 by mingming88 on Monday 27th of April 2009 08:27:01 AM
Old 04-27-2009
how to combine 2 files by join

i wanna combine 2 files that need to use join(need to use -a1 -a2) to produce a new file and also need to sort the new file in numerical order by ID.

The format of 2 files is:
Filename: Prac1
# Results for Prac1. The format is:
# 12345677 10
20693680 10
20179687 9
20781637 5
21907894 6

Filename: Prac2
# Results for Prac2. The format is:
# 12345677 10
20693680 8
20179687 6
21907894 2

also need to ignore the # in the file.

The format of the file produced by the 2 files is
20179687 9 8
20693680 10 8
20781637 5
21907894 6 2

Can anyone please help me with this question?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need To Combine 2 Files

I have 2 files that I need to combine. One file is looks like this: 71664107;1;1;05-FEB-07;12-FEB-07; The other file looks like this: U;71664107;dummy;Pirovano;M;04-SEP-75;Georgia;MI;1;1;31;S;S;;;Y;05-02-2007;0;12-FEB-07; I need to combine both files together. I need the shorter... (4 Replies)
Discussion started by: goodmis
4 Replies

2. HP-UX

How to combine 2 different files

Hi : I have a file containing the print queues with their IP address. I wanted to combine the 'lpstat' output with their respective IP address. For example : zebhtrmb-6078 lgonzale priority 0 Mar 17 11:50 on zebhtrmb with zebhtrmb-6078 lgonzale priority 0 ... (1 Reply)
Discussion started by: rdasari
1 Replies

3. Shell Programming and Scripting

How to Merge / combine / join / paste 2 text files side-by-side

I have 2 text files, both have one simple, single column. The 2 files might be the same length, or might not, and if not, it's unknown which one would be longer. For this example, file1 is longer: ---file1 Joe Bob Mary Sally Fred Elmer David ---file2 Tomato House Car... (3 Replies)
Discussion started by: cajunfries
3 Replies

4. UNIX for Dummies Questions & Answers

Join 2 files with multiple columns: awk/grep/join?

Hello, My apologies if this has been posted elsewhere, I have had a look at several threads but I am still confused how to use these functions. I have two files, each with 5 columns: File A: (tab-delimited) PDB CHAIN Start End Fragment 1avq A 171 176 awyfan 1avq A 172 177 wyfany 1c7k A 2 7... (3 Replies)
Discussion started by: InfoSeeker
3 Replies

5. Shell Programming and Scripting

combine multiple files by column into one files already sorted!

I have multiple files; each file contains a certain data in a column view simply i want to combine all those files into one file in columns example file1: a b c d file 2: 1 2 3 4 file 3: G (4 Replies)
Discussion started by: ahmedamro
4 Replies

6. UNIX for Dummies Questions & Answers

how to join two files using "Join" command with one common field in this problem?

file1: Toronto:12439755:1076359:July 1, 1867:6 Quebec City:7560592:1542056:July 1, 1867:5 Halifax:938134:55284:July 1, 1867:4 Fredericton:751400:72908:July 1, 1867:3 Winnipeg:1170300:647797:July 15, 1870:7 Victoria:4168123:944735:July 20, 1871:10 Charlottetown:137900:5660:July 1, 1873:2... (2 Replies)
Discussion started by: mindfreak
2 Replies

7. UNIX for Dummies Questions & Answers

How to use the the join command to join multiple files by a common column

Hi, I have 20 tab delimited text files that have a common column (column 1). The files are named GSM1.txt through GSM20.txt. Each file has 3 columns (2 other columns in addition to the first common column). I want to write a script to join the files by the first common column so that in the... (5 Replies)
Discussion started by: evelibertine
5 Replies

8. Shell Programming and Scripting

Trying to combine fields with sort/join

I have a file with two fields in it delimited by a comma. Some of the first fields are duplicates. I am trying to eliminate any duplicate records in the first field, and combine the second fields in the output file. For example, if the input is: Jane,group=A Bob,group=A Bob,group=D... (3 Replies)
Discussion started by: DJR
3 Replies

9. UNIX for Beginners Questions & Answers

Automate splitting of files , scp files as each split completes and combine files on target server

i use the split command to split a one terabyte backup file into 10 chunks of 100 GB each. The files are split one after the other. While the files is being split, I will like to scp the files one after the other as soon as the previous one completes, from server A to Server B. Then on server B ,... (2 Replies)
Discussion started by: malaika
2 Replies

10. Shell Programming and Scripting

Join, merge, fill NULL the void columns of multiples files like sql "LEFT JOIN" by using awk

Hello, This post is already here but want to do this with another way Merge multiples files with multiples duplicates keys by filling "NULL" the void columns for anothers joinning files file1.csv: 1|abc 1|def 2|ghi 2|jkl 3|mno 3|pqr file2.csv: 1|123|jojo 1|NULL|bibi... (2 Replies)
Discussion started by: yjacknewton
2 Replies
Crypt::DSA::Key(3pm)					User Contributed Perl Documentation				      Crypt::DSA::Key(3pm)

NAME
Crypt::DSA::Key - DSA key SYNOPSIS
use Crypt::DSA::Key; my $key = Crypt::DSA::Key->new; $key->p($p); DESCRIPTION
Crypt::DSA::Key contains a DSA key, both the public and private portions. Subclasses of Crypt::DSA::Key implement read and write methods, such that you can store DSA keys on disk, and read them back into your application. USAGE
Any of the key attributes can be accessed through combination get/set methods. The key attributes are: p, q, g, priv_key, and pub_key. For example: $key->p($p); my $p2 = $key->p; $key = Crypt::DSA::Key->new(%arg) Creates a new (empty) key object. All of the attributes are initialized to 0. Alternately, if you provide the Filename parameter (see below), the key will be read in from disk. If you provide the Type parameter (mandatory if Filename is provided), be aware that your key will actually be blessed into a subclass of Crypt::DSA::Key. Specifically, it will be the class implementing the specific read functionality for that type, eg. Crypt::DSA::Key::PEM. Returns the key on success, "undef" otherwise. (See Password for one reason why new might return "undef"). %arg can contain: o Type The type of file where the key is stored. Currently the only option is PEM, which indicates a PEM file (optionally encrypted, ASN.1-encoded object). Support for reading/writing PEM files comes from Convert::PEM; if you don't have this module installed, the new method will die. This argument is mandatory, if you're either reading the file from disk (ie. you provide a Filename argument) or you've specified the Content argument. o Filename The location of the file from which you'd like to read the key. Requires a Type argument so the decoder knows what type of file it is. You can't specify Content and Filename at the same time. o Content The serialized version of the key. Requires a Type argument so the decoder knows how to decode it. You can't specify Content and Filename at the same time. o Password If your key file is encrypted, you'll need to supply a passphrase to decrypt it. You can do that here. If your passphrase is incorrect, new will return "undef". $key->write(%arg) Writes a key (optionally) to disk, using a format that you define with the Type parameter. If your $key object has a defined priv_key (private key portion), the key will be written as a DSA private key object; otherwise, it will be written out as a public key. Note that not all serialization mechanisms can produce public keys in this version--currently, only PEM public keys are supported. %arg can include: o Type The type of file format that you wish to write. PEM is one example (in fact, currently, it's the only example). This argument is mandatory, unless your $key object is already blessed into a subclass (eg. Crypt::DSA::Key::PEM), and you wish to write the file using the same subclass. o Filename The location of the file on disk where you want the key file to be written. o Password If you want the key file to be encrypted, provide this argument, and the ASN.1-encoded string will be encrypted using the passphrase as a key. $key->size Returns the size of the key, in bits. This is actually the number of bits in the large prime p. AUTHOR &; COPYRIGHTS Please see the Crypt::DSA manpage for author, copyright, and license information. perl v5.12.4 2011-06-17 Crypt::DSA::Key(3pm)
All times are GMT -4. The time now is 07:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy