I have two text files. File 1 has 150 ids but all the ids exists in duplicates so it has 300 ids in total. File 2 has 1500 ids but all exists in duplicates so file 2 has 300 ids in total. i want to match the first occurance of every id in file 1 with first occurance of thet id in file 2 and 2nd occurance of id in file1 with the 2nd occurance of id in file 2. and based upon the value in column 2 print match or mismatch. Looking for an awk sed solution
I have two files. One has:
ID# 0 a b c d e f g h i j k....................~2 milion columns
ID# 0 l m n o p q r s t u v....................~2 milion columns
.
.
.
~6000 lines
Other has:
ID# 1
or
ID# 2
.
.
~6000 lines (2 Replies)
Dear awk users,
I am trying to use awk to match records across two moderately large CSV files. File1 is a pattern file with 173,200 lines, many of which are repeated. The order in which these lines are displayed is important, and I would like to preserve it. File2 is a data file with 456,000... (3 Replies)
Hello,
I want to extract columns from file2 to file3 by matching ids between file1 and file2. The extracted columns should be in same order as file1 ids.
for example:
file1.txt
1823
607
R2A9
802
771
file2.txt
1823 1 2 4
22 11 4 29
607 12 3 3
R2A9... (8 Replies)
Hello,
I have two files
Original: ( 5000 entries)
Chr Position
chr1 879108
chr1 881918
chr1 896874 ...
and a file with allele freq ( 2000 entries)
Chr Position MAF
chr1 881918 0.007
chr1 979748 0.007
chr1... (9 Replies)
Hi, I am trying to merge information across 2 files. The first file is a "master" file, with all IDS. File 2 contains a subset of IDs of those in File 1.
I would like to match up individuals in File 1 and File 2, and add information in File 2 to that of File 1 if they appear. However, if an... (3 Replies)
Hello all
I have a file my DNS server where there are duplicate paragrapsh like below. How can I remove the duplicate paragraph so that only one paragraph remains.
BEGIN;
replace into domains (name,type) values ('225.168.192.in-addr.arpa','MASTER');
replace into records (domain_id,... (2 Replies)
Hello,
I have two files
File 1 with 10 columns
rsid position ........
xx 1:10000
File 2
position
1:10000
2:2000
....
I need to extract the IDs given in file 2(column1) from file 1 (column2) and print all columns from file1. I am trying this command (1 Reply)
I wish to pull out a list of all user ids on the system, including the privileged ids, the groups to which they belong to. Sometimes after deleting an id also, its home dir does not get deleted or an entry is left behind in /etc/passwd.
Can someone help me with a script to achieve both. (2 Replies)
Hi,
i have 2 files , the data i need to match is in masterfile and i need to pull out column 3 from master if column 1 and 2 match and output entire row to new file
I have tried with join and awk and i keep getting blank outputs or same file
is there an easier way than what i am... (4 Replies)
Discussion started by: axis88
4 Replies
LEARN ABOUT OPENSOLARIS
semids
semids(2) System Calls semids(2)NAME
semids - discover all semaphore identifiers
SYNOPSIS
#include <sys/sem.h>
int semids(int *buf, uint_t nids, uint_t *pnids);
DESCRIPTION
The semids() function copies all active semaphore identifiers from the system into the user-defined buffer specified by buf, provided that
the number of such identifiers is not greater than the number of integers the buffer can contain, as specified by nids. If the size of the
buffer is insufficient to contain all of the active semaphore identifiers in the system, none are copied.
Whether or not the size of the buffer is sufficient to contain all of them, the number of active semaphore identifiers in the system is
copied into the unsigned integer pointed to by pnids.
If nids is 0 or less than the number of active semaphore identifiers in the system, buf is ignored.
RETURN VALUES
Upon successful completion, semids() returns 0. Otherwise, -1 is returned and errno is set to indicate the error.
ERRORS
The semids() function will fail if:
EFAULT The buf or pnids argument points to an illegal address.
USAGE
The semids() function returns a snapshot of all the active semaphore identifiers in the system. More may be added and some may be removed
before they can be used by the caller.
EXAMPLES
Example 1 semids() example
This is sample C code indicating how to use the semids() function.
void
examine_semids()
{
int *ids = NULL;
uint_t nids = 0;
uint_t n;
int i;
for (;;) {
if (semids(ids, nids, &n) != 0) {
perror("semids");
exit(1);
}
if (n <= nids) /* we got them all */
break;
/* we need a bigger buffer */
ids = realloc(ids, (nids = n) * sizeof (int));
}
for (i = 0; i < n; i++)
process_semid(ids[i]);
free(ids);
}
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|MT-Level |Async-Signal-Safe |
+-----------------------------+-----------------------------+
SEE ALSO ipcrm(1), ipcs(1), Intro(2), semctl(2), semget(2), semop(2), attributes(5)SunOS 5.11 8 Mar 2000 semids(2)