Sponsored Content
Top Forums Shell Programming and Scripting Find All duplicates based on multiple keys Post 302871633 by unme on Wednesday 6th of November 2013 01:05:39 PM
Old 11-06-2013
Thanks a lot working fine...
 

10 More Discussions You Might Find Interesting

1. Programming

marge tow files based on keys

how can i marge two files depend som key for example: the first file include many records of information for X person and the second file have one record of information for each X person shortly i want to mak first :match between the two files then insert data from the second to the first... (2 Replies)
Discussion started by: Ehab
2 Replies

2. Shell Programming and Scripting

removing duplicates based on key

HI I am having a file like this 1234 12345678 1234567890123 4321 43215678 432156789028433435 I want to get ouput as 1234567890123 432156789028433435 based on key position 1-4 I am using ksh can anyone give me an idea Thanks pukars (1 Reply)
Discussion started by: pukars4u
1 Replies

3. UNIX for Dummies Questions & Answers

Joining files based on multiple keys

I need a script (perl or awk..anything is fine) to join 3 files based on three key columns. The no of non-key columns can vary in each file. The columns are delimited by semicolon. For example, File1 Dim1;Dim2;Dim3;Fact1;Fact2;Fact3;Fact4;Fact5 ---- data delimited by semicolon --- ... (1 Reply)
Discussion started by: Sebben
1 Replies

4. Shell Programming and Scripting

select values based on keys

HI The input 1st column has specific keys like 1 with value a,b and c. 2 with b,b,d and 3 with a,a a. when ever c appears as one of the values the result will be key ........ c (You can see in the out put as 1 w...... 6.... c) and same follows for d. Thanx:) I'm learning awk scripting. If... (3 Replies)
Discussion started by: repinementer
3 Replies

5. Shell Programming and Scripting

Sum a column value based on multiple keys

Hi, I have below as i/p file: 5ABC 36488989 K 000010000ASB BYTRES 5PQR 45757754 K 000200005KPC HGTRET 5ABC 36488989 K 000045000ASB HGTRET 5GTH 36488989 K 000200200ASB BYTRES 5FTU ... (2 Replies)
Discussion started by: nirnkv
2 Replies

6. Shell Programming and Scripting

Sorting problem: Multiple delimiters, multiple keys

Hello If you wanted to sort a .csv file that was filled with lines like this: <Ticker>,<Date as YYYYMMDD>,<Time as H:M:S>,<Volume>,<Corr> (H : , M, S: ) by date, does anybody know of a better solution than to turn the 3rd and 4th colons of every line into commas, sorting on four keys,... (20 Replies)
Discussion started by: Ryan.
20 Replies

7. UNIX for Dummies Questions & Answers

Removing duplicates based on key

Hi, I have the input file with the below data: 12345|12|34 12345|13|23 3456|12|90 15670|12|13 12345|10|14 3456|12|13 I need to remove the duplicates based on the first field only. I need the output like: 12345|12|34 3456|12|90 15670|12|13 The first field needs to be unique . (4 Replies)
Discussion started by: pandeesh
4 Replies

8. Shell Programming and Scripting

Remove duplicates based on a field's value

Hi All, I have a text file with three columns. I would like a simple script that removes lines in which column 1 has duplicate entries, but use the largest value in column 3 to decide which one to keep. For example: Input file: 12345a rerere.rerere len=23 11111c fsdfdf.dfsdfdsf len=33 ... (3 Replies)
Discussion started by: anniecarv
3 Replies

9. Shell Programming and Scripting

Looping in Perl based on defined keys in Map

Hello All, I am writing the below script where it will connect to database and returns the results. #!/sw/gcm/perl510/bin/perl use SybaseC; &openConnection; &loadvalues; sub openConnection { $dbproc = new SybaseC(SYDB}, $ENV{DBDFLTUSR}, $ENV{DBDFLTPWD}); if... (2 Replies)
Discussion started by: filter
2 Replies

10. Shell Programming and Scripting

Combine multiple rows based on selected column keys

Hello I want to collapse a file with multiple rows into consolidated lines of entries based on selected columns as the 'key'. Example: 1 2 3 Abc def ghi 1 2 3 jkl mno p qrts 6 9 0 mno def Abc 7 8 4 Abc mno mno abc 7 8 9 mno mno abc 7 8 9 mno j k So if columns 1, 2 and 3 are... (6 Replies)
Discussion started by: linuxlearner123
6 Replies
libtnfctl(3TNF) 					       TNF Library Functions						   libtnfctl(3TNF)

NAME
libtnfctl - library for TNF probe control in a process or the kernel SYNOPSIS
cc [ flag ... ] file ... -ltnfctl [ library ... ] #include <tnf/tnfctl.h> DESCRIPTION
The libtnfctl library provides an API to control TNF ("Trace Normal Form") probes within a process or the kernel. See tracing(3TNF) for an overview of the Solaris tracing architecture. The client of libtnfctl controls probes in one of four modes: internal mode The target is the controlling process itself; that is, the client controls its own probes. direct mode The target is a separate process; a client can either exec(2) a program or attach to a running process for probe control. The libtnfctl library uses proc(4) on the target process for probe and process control in this mode, and additionally pro- vides basic process control features. indirect mode The target is a separate process, but the controlling process is already using proc(4) to control the target, and hence libtnfctl cannot use those interfaces directly. Use this mode to control probes from within a debugger. In this mode, the client must provide a set of functions that libtnfctl can use to query and update the target process. kernel mode The target is the Solaris kernel. A process is controlled "externally" if it is being controlled in either direct mode or indirect mode. Alternatively, a process is con- trolled "internally" when it uses internal mode to control its own probes. There can be only one client at a time doing probe control on a given process. Therefore, it is not possible for a process to be controlled internally while it is being controlled externally. It is also not possible to have a process controlled by multiple external processes. Similarly, there can be only one process at a time doing kernel probe control. Note, however, that while a given target may only be con- trolled by one libtnfctl client, a single client may control an arbitrary number of targets. That is, it is possible for a process to simultaneously control its own probes, probes in other processes, and probes in the kernel. The following tables denotes the modes applicable to all libtnfctl interfaces (INT = internal mode; D = direct mode; IND = indirect mode; K = kernel mode). These interfaces create handles in the specified modes: tnfctl_internal_open() INT tnfctl_exec_open() D tnfctl_pid_open() D tnfctl_indirect_open() IND tnfctl_kernel_open() K These interfaces are used with the specified modes: tnfctl_continue() D tnfctl_probe_connect() INT D IND tnfctl_probe_disconnect_all () INT D IND tnfctl_trace_attrs_get() INT D IND K tnfctl_buffer_alloc() INT D IND K tnfctl_register_funcs() INT D IND K tnfctl_probe_apply() INT D IND K tnfctl_probe_apply_ids() INT D IND K tnfctl_probe_state_get () INT D IND K tnfctl_probe_enable() INT D IND K tnfctl_probe_disable() INT D IND K tnfctl_probe_trace() INT D IND K tnfctl_probe_untrace() INT D IND K tnfctl_check_libs() INT D IND K tnfctl_close() INT D IND K tnfctl_strerror() INT D IND K tnfctl_buffer_dealloc() K tnfctl_trace_state_set() K tnfctl_filter_state_set() K tnfctl_filter_list_get() K tnfctl_filter_list_add() K tnfctl_filter_list_delete() K When using libtnfctl, the first task is to create a handle for controlling probes. The tnfctl_internal_open() function creates an internal mode handle for controlling probes in the same process, as described above. The tnfctl_pid_open() and tnfctl_exec_open() functions create handles in direct mode. The tnfctl_indirect_open() function creates an indirect mode handle, and the tnfctl_kernel_open() function creates a kernel mode handle. A handle is required for use in nearly all other libtnfctl functions. The tnfctl_close() function releases the resources associated with a handle. The tnfctl_continue() function is used in direct mode to resume execution of the target process. The tnfctl_buffer_alloc() function allocates a trace file or, in kernel mode, a trace buffer. The tnfctl_probe_apply() and tnfctl_probe_apply_ids() functions call a specified function for each probe or for a designated set of probes. The tnfctl_register_funcs() function registers functions to be called whenever new probes are seen or probes have disappeared, providing an opportunity to do one-time processing for each probe. The tnfctl_check_libs() function is used primarily in indirect mode to check whether any new probes have appeared, that is, they have been made available by dlopen(3C), or have disappeared, that is, they have disassociated from the process by dlclose(3C). The tnfctl_probe_enable() and tnfctl_probe_disable() functions control whether the probe, when hit, will be ignored. The tnfctl_probe_trace() and tnfctl_probe_untrace() functions control whether an enabled probe, when hit, will cause an entry to be made in the trace file. The tnfctl_probe_connect() and tnfctl_probe_disconnect_all() functions control which functions, if any, are called when an enabled probe is hit. The tnfctl_probe_state_get() function returns information about the status of a probe, such as whether it is currently enabled. The tnfctl_trace_attrs_get() function returns information about the tracing session, such as the size of the trace buffer or trace file. The tnfctl_strerror() function maps a tnfctl error code to a string, for reporting purposes. The remaining functions apply only to kernel mode. The tnfctl_trace_state_set() function controls the master switch for kernel tracing. See prex(1) for more details. The tnfctl_filter_state_set(), tnfctl_filter_list_get(), tnfctl_filter_list_add(), and tnfctl_filter_list_delete() functions allow a set of processes to be specified for which probes will not be ignored when hit. This prevents kernel activity caused by uninteresting processes from cluttering up the kernel's trace buffer. The tnfctl_buffer_dealloc() function deallocates the kernel's internal trace buffer. RETURN VALUES
Upon successful completion, these functions returnTNFCTL_ERR_NONE. ERRORS
The error codes for libtnfctl are: TNFCTL_ERR_ACCES Permission denied. TNFCTL_ERR_NOTARGET The target process completed. TNFCTL_ERR_ALLOCFAIL A memory allocation failure occurred. TNFCTL_ERR_INTERNAL An internal error occurred. TNFCTL_ERR_SIZETOOSMALL The requested trace size is too small. TNFCTL_ERR_SIZETOOBIG The requested trace size is too big. TNFCTL_ERR_BADARG Bad input argument. TNFCTL_ERR_NOTDYNAMIC The target is not a dynamic executable. TNFCTL_ERR_NOLIBTNFPROBE libtnfprobe.so not linked in target. TNFCTL_ERR_BUFBROKEN Tracing is broken in the target. TNFCTL_ERR_BUFEXISTS A buffer already exists. TNFCTL_ERR_NOBUF No buffer exists. TNFCTL_ERR_BADDEALLOC Cannot deallocate buffer. TNFCTL_ERR_NOPROCESS No such target process exists. TNFCTL_ERR_FILENOTFOUND File not found. TNFCTL_ERR_BUSY Cannot attach to process or kernel because it is already tracing. TNFCTL_ERR_INVALIDPROBE Probe no longer valid. TNFCTL_ERR_USR1 Error code reserved for user. TNFCTL_ERR_USR2 Error code reserved for user. TNFCTL_ERR_USR3 Error code reserved for user. TNFCTL_ERR_USR4 Error code reserved for user. TNFCTL_ERR_USR5 Error code reserved for user. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWtnfc | +-----------------------------+-----------------------------+ |MT Level |MT-Safe with exceptions | +-----------------------------+-----------------------------+ SEE ALSO
prex(1), exec(2), dlclose(3C), dlopen(3C), TNF_PROBE(3TNF), tnfctl_buffer_alloc(3TNF), tnfctl_buffer_dealloc(3TNF), tnfctl_check_libs(3TNF), tnfctl_close(3TNF), tnfctl_continue(3TNF), tnfctl_internal_open(3TNF), tnfctl_exec_open(3TNF), tnfctl_fil- ter_list_add(3TNF), tnfctl_filter_list_delete(3TNF), tnfctl_filter_list_get(3TNF), tnfctl_filter_state_set(3TNF), tnfctl_kernel_open(3TNF), tnfctl_pid_open(3TNF), tnfctl_probe_apply(3TNF), tnfctl_probe_apply_ids(3TNF), tnfctl_probe_connect(3TNF), tnfctl_probe_disable(3TNF), tnfctl_probe_enable(3TNF), tnfctl_probe_state_get(3TNF), tnfctl_probe_trace(3TNF), tnfctl_probe_untrace(3TNF), tnfctl_indirect_open(3TNF), tnfctl_register_funcs(3TNF), tnfctl_strerror(3TNF), tnfctl_trace_attrs_get(3TNF), tnfctl_trace_state_set(3TNF), libtnfctl(3LIB), proc(4), attributes(5) Linker and Libraries Guide NOTES
This API is MT-Safe. Multiple threads may concurrently operate on independent tnfctl handles, which is the typical behavior expected. The libtnfctl library does not support multiple threads operating on the same tnfctl handle. If this is desired, it is the client's responsibility to implement locking to ensure that two threads that use the same tnfctl handle are not simultaneously in a libtnfctl interface. SunOS 5.11 1 Mar 2004 libtnfctl(3TNF)
All times are GMT -4. The time now is 11:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy