Sponsored Content
Full Discussion: Duplicate values merge
Top Forums Shell Programming and Scripting Duplicate values merge Post 302768709 by jiam912 on Saturday 9th of February 2013 08:44:59 AM
Old 02-09-2013
Duplicate values merge

Dear Gents,

Please can you help me to solve this problem.

Input file...

Code:
22057485  ,219 ,1050
22057485  ,223 ,1050
21897425  ,278 ,1050
21897425  ,279 ,1050
21897425  ,287 ,1050
20497465  ,602 ,1051
20517500  ,677 ,1051
20517500  ,681 ,1051
20577555  ,775 ,1052
20577555  ,778 ,1052
20357560  ,778 ,1052
20357560  ,780 ,1052
23717535  ,794 ,1053
23717535  ,805 ,1053
23657530  ,797 ,1053
23657530  ,798 ,1053
23657530  ,799 ,1053

I would like to get something like it:

output file

Code:
1050  22057485    219    223    
1050  21897425    278    279    287
1051  20497465    602    603    605
1051  20517500    677    681    
1052  20577555    775    778    
1052  20357560    778    780    
1053  23717535    794    805    
1053  23657530    797    798    799

Thanks in advance
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

merge files with same row values

Hi everyone, I'm just wondering how could I using awk language merge two files by comparison of one their row. I mean, I have one file like this: file#1: 21/07/2009 11:45:00 100.0000000 27.2727280 21/07/2009 11:50:00 75.9856644 25.2492676 21/07/2009 11:55:00 51.9713287 23.2258072... (4 Replies)
Discussion started by: tonet
4 Replies

2. Shell Programming and Scripting

Awk: How to merge duplicate lines and print in a single

The input file: >cat module1 200611051053 95 200523457498 35 200617890187 57 200726098123 66 200645676712 71 200744556590 68 >cat module2 200645676712 ... (10 Replies)
Discussion started by: winter9
10 Replies

3. Shell Programming and Scripting

duplicate values

Hi, How to enumerate duplicate values, without sorting the file. example 1 1 2 1 3 1 1 2 2 2 3 2 1 3 2 3 3 3 Where the first column have the repetead values without sorting, I would like to get the value of the times that the value is repetead , as I show... (2 Replies)
Discussion started by: jiam912
2 Replies

4. Shell Programming and Scripting

Extract values of duplicate keys

I have two questions that are related, so it would be great if you can help me with both! Question1: I have a file A that looks like this: a x b y b z c w I want to get something like: a x b y; z c w Given that a,b,c has no spaces. But the other letters might contain spaces. ... (2 Replies)
Discussion started by: Viernes
2 Replies

5. Shell Programming and Scripting

Append values of duplicate entries

My input file is: LOC_Os01g01870 GO:0006139 LOC_Os01g01870 GO:0009058 LOC_Os01g02570 GO:0006464 LOC_Os01g02570 GO:0009987 LOC_Os01g02570 GO:0008152 LOC_Os01g04380 GO:0006950 LOC_Os01g04380 GO:0009628 I want to append the duplicate values in a tab/space... (2 Replies)
Discussion started by: Sanchari
2 Replies

6. Shell Programming and Scripting

Remove duplicate values with condition

Hi Gents, Please can you help me to get the desired output . In the first column I have some duplicate records, The condition is that all need to reject the duplicate record keeping the last occurrence. But the condition is. If the last occurrence is equal to value 14 or 98 in column 3 and... (2 Replies)
Discussion started by: jiam912
2 Replies

7. Shell Programming and Scripting

How to merge two files with unique values matching.?

I have one script as below: #!/bin/ksh Outputfile1="/home/OutputFile1.xls" Outputfile2="/home/OutputFile2.xls" InputFile1="/home/InputFile1.sql" InputFile2="/home/InputFile2.sql" echo "Select hobby, class, subject, sports, rollNumber from Student_Table" >> InputFile1 echo "Select rollNumber... (3 Replies)
Discussion started by: Sharma331
3 Replies

8. Shell Programming and Scripting

Find duplicate values in specific column and delete all the duplicate values

Dear folks I have a map file of around 54K lines and some of the values in the second column have the same value and I want to find them and delete all of the same values. I looked over duplicate commands but my case is not to keep one of the duplicate values. I want to remove all of the same... (4 Replies)
Discussion started by: sajmar
4 Replies

9. Shell Programming and Scripting

Join and merge multiple files with duplicate key and fill void columns

Join and merge multiple files with duplicate key and fill void columns Hi guys, I have many files that I want to merge: file1.csv: 1|abc 1|def 2|ghi 2|jkl 3|mno 3|pqr file2.csv: (5 Replies)
Discussion started by: yjacknewton
5 Replies
tnameserv(1)						      General Commands Manual						      tnameserv(1)

NAME
tnameserv - Java IDL name server starter script SYNOPSIS
tnameserv -ORBInitialPort portNumber DESCRIPTION
The CORBA COS (Common Object Services) Naming Service provides a tree-like directory for object references much like a filesystem provides a directory structure for files. The Naming Service provided with Java IDL is a simple implementation of the COS Naming Service specifica- tion. Object references are stored in the namespace by name and each object reference-name pair is called a name binding. Name bindings may be organized under naming contexts. Naming contexts are themselves name bindings and serve the same organizational function as a file system subdirectory. All bindings are stored under the initial naming context. The initial naming context is the only persistent binding in the namespace; the rest of the namespace is lost if the Java IDL name server process halts and restarts. For an applet or application to use COS naming, its ORB must know the name and port of a host running a naming service or have access to a stringified initial naming context for that name server. The naming service can either be the Java IDL name server or another COS-compli- ant name service. USAGE
Starting the Java IDL Name Server You must start the Java IDL name server before an application or applet that uses its naming service. Installation of the Java IDL product creates a script named tnameserv that starts the Java IDL name server. Start the name server so it runs in the background. If you do not specify otherwise, the Java IDL name server listens on port 900 for the bootstrap protocol used to implement the ORB resolve_initial_references() and list_initial_references() methods. Specify a different port, for example, 1050, as follows: example% tnameserv -ORBInitialPort 1050 Clients of the name server must be made aware of the new port number. Do this by setting the org.omg.CORBA.ORBInitialPort property to the new port number when creating the ORB object. Stopping the Java IDL Name Server To stop the Java IDL name server, use the relevant operating system command, such as kill(1). Note that names registered with the Java IDL name service disappear when the server is terminated. Sample Client: Adding Objects The following sample program illustrates how to add names to the namespace. It is a self-contained Name Server client that creates the following simple tree. Initial Naming Context / / plans personal / / calendar schedule In this example, "plans" is an object reference and "personal" is a naming context that contains two object references: "calendar" and "schedule". import java.util.Properties; import org.omg.CORBA.*; import org.omg.CosNaming.*; public class NameClient { public static void main(String args[]) { try { In the above section, Starting the Java IDL Name Server, the nameserver was started on port 1050. The following code ensures that the client program is aware of this port number. Properties props = new Properties(); props.put("org.omg.CORBA.ORBInitialPort", "1050"); ORB orb = ORB.init(args, props); The following code obtains the initial naming context and assigns it to ctx. The second line copies ctx into a dummy object reference, objref, that we will attach to various names and add into the namespace. NamingContext ctx = NamingContextHelper.narrow (orb.resolve_initial_references("NameService")); NamingContext objref = ctx; The following code creates a name "plans" of type "text" and binds it to our dummy object reference. "plans" is then added under the ini- tial naming context using rebind. The rebind method allows us to run this program over and over again without getting the exceptions we would get from using bind. NameComponent nc1 = new NameComponent("plans", "text"); NameComponent[] name1 = {nc1}; ctx.rebind(name1, objref); System.out.println("plans rebind sucessful!"); The following code creates a naming context called "Personal" of type "directory". The resulting object reference, ctx2, is bound to the name and added under the initial naming context. NameComponent nc2 = new NameComponent("Personal", "directory"); NameComponent[] name2 = {nc2}; NamingContext ctx2 = ctx.bind_new_context(name2); System.out.println("new naming context added.."); The remainder of the code binds the dummy object reference using the names "schedule" and "calendar" under the "Personal" naming context (ctx2). NameComponent nc3 = new NameComponent("schedule", "text"); NameComponent[] name3 = {nc3}; ctx2.rebind(name3, objref); System.out.println("schedule rebind sucessful!"); NameComponent nc4 = new NameComponent("calender", "text"); NameComponent[] name4 = {nc4}; ctx2.rebind(name4, objref); System.out.println("calender rebind sucessful!"); } catch (Exception e) { e.printStackTrace(System.err); } } } Sample Client: Browsing the Namespace The following sample program illustrates how to browse the namespace. import java.util.Properties; import org.omg.CORBA.*; import org.omg.CosNaming.*; public class NameClientList { public static void main(String args[]) { try { In the above section, Starting the Java IDL Name Server, the nameserver was started on port 1050. The following code ensures that the client program is aware of this port number. Properties props = new Properties(); props.put("org.omg.CORBA.ORBInitialPort", "1050"); ORB orb = ORB.init(args, props); The following code obtains the initial naming context. NamingContext nc = NamingContextHelper.narrow (orb.resolve_initial_references("NameService")); The list method lists the bindings in the naming context. In this case, up to 1000 bindings from the initial naming context will be returned in the BindingListHolder; any remaining bindings are returned in the BindingIteratorHolder. BindingListHolder bl = new BindingListHolder(); BindingIteratorHolder blIt= new BindingIteratorHolder(); nc.list(1000, bl, blIt); The following code gets the array of bindings out of the returned BindingListHolder. If there are no bindings, the program ends. Binding bindings[] = bl.value; if (bindings.length == 0) return; The remainder of the code loops through the bindings and prints the names out. for (int i=0; i < bindings.length; i++) { // get the object reference for each binding org.omg.CORBA.Object obj = nc.resolve (bindings[i].binding_name); String objStr = orb.object_to_string(obj); int lastIx = bindings[i].binding_name.length-1; // check to see if this is a naming context if (bindings[i].binding_type == BindingType.ncontext) { System.out.println ("Context: " + bindings[i].binding_name[lastIx].id); } else { System.out.println ("Object: " + bindings[i].binding_name[lastIx].id); } } } catch (Exception e) { e.printStackTrace(System.err); } } } SEE ALSO
kill(1) 13 June 2000 tnameserv(1)
All times are GMT -4. The time now is 03:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy