04-18-2018
I did not know the 'delete' function. It's great !
I did not know neither the form '!count[b[i]]++' instead of 'count[b[i]]++==0'
Thanks !
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all this is a UNIX question.
I have a large flat file with millions of records.
col1|col2|col3
1|a|b
2|c|d
3|e|f
3|g|h
footer****
I am supposed to calculate the sum of col1 1+2+3+3=9, count of col1 1,2,3,3=4, and distinct count of col1 1,2,3=c3
I would like it if you avoid... (4 Replies)
Discussion started by: singhabhijit
4 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I have to search and count unique occurence of DE numbers in bold below in a file which has content like below.
Proc Tran F-BUY
Item Tkey Q5JV
Item Tsid JTIZ9
Item Tdat 20091001
Item Tset 20091001
Item Tbkr 5
Item Tshs 2
Item Tprc 897.0
Item Tcom 2000.0
Item Tcm1 20091001... (6 Replies)
Discussion started by: akash028
6 Replies
3. Shell Programming and Scripting
Dear all,
I have been trying to print an entire field, if the first line of the field is matching.
For example, my input looks something like this.
aaa ddd zzz
123 987 126
24 0.650 985
354 9864 0.32
0.333 4324 000
I am looking for a pattern,... (5 Replies)
Discussion started by: Chulamakuri
5 Replies
4. Shell Programming and Scripting
I have a input.txt file which have 3 fields separate by a comma
place, os and timediff in seconds
tampa,win7, 2575
tampa,win7, 157619
tampa,win7, 3352
dallas,vista,604799
greenbay,winxp, 14400
greenbay,win7 , 518400
san jose,winxp, 228121
san jose,winxp, 70853
san jose,winxp, 193514... (5 Replies)
Discussion started by: sabercats
5 Replies
5. Shell Programming and Scripting
I have an input that looks like this:
chr1 mm9_knownGene utr3 3204563 3206102 0 - . gene_id "Xkr4"; transcript_id "uc007aeu.1";
chr1 mm9_knownGene utr3 4280927 4283061 0 - . gene_id "Rp1"; transcript_id "uc007aew.1";
chr1 mm9_knownGene ... (5 Replies)
Discussion started by: pbluescript
5 Replies
6. Shell Programming and Scripting
Hi I am trying to carry out a sum on a file (totals.txt).
The file looks like:
So far i have this command
this returns 20610
I however want it to return 000000206100
Any help would be great
thanks! (6 Replies)
Discussion started by: nwalsh88
6 Replies
7. Shell Programming and Scripting
Hello,
I`m a complete newbie to coding, please help with this problem.
I have multiple files in a directory, I have to loop through the contents of each file and extract number of unique isoforms in that file. Each file is tab delimited and only the line with the first parent (column 3)... (1 Reply)
Discussion started by: ritakadm
1 Replies
8. Shell Programming and Scripting
Im looking for an awk script that will take the unique values in column 5, then print and count the unique values in column 6.
CA001011500 11111 11111 -9999 201301 AAA
CA001012040 11111 11111 -9999 201301 AAA
CA001012573 11111 11111 -9999 201301 BBB
CA001012710 11111 11111 -9999 201301... (4 Replies)
Discussion started by: ncwxpanther
4 Replies
9. Shell Programming and Scripting
When I use the below awk to count the unique lines in $4 for the input it seems to work. The answer is 3 because $4 is only unique 3 times in all the entries. However, when I use the same on actual data I get 56,536 and I know the answer should be 56,548. My question is there a better way to... (8 Replies)
Discussion started by: cmccabe
8 Replies
10. UNIX for Beginners Questions & Answers
I cannot seem to get what should be a simple awk one-liner to work correctly and cannot figure out why. I would like to use patterns from a specific field in one file as regex to search for matching strings in the entire line ($0) of another file.
I would like to output the lines of File2 which... (1 Reply)
Discussion started by: jvoot
1 Replies
LEARN ABOUT OPENSOLARIS
_lwp_sema_post
_lwp_sema_wait(2) System Calls _lwp_sema_wait(2)
NAME
_lwp_sema_wait, _lwp_sema_trywait, _lwp_sema_init, _lwp_sema_post - semaphore operations
SYNOPSIS
#include <sys/lwp.h>
int _lwp_sema_wait(lwp_sema_t *sema);
int _lwp_sema_trywait(lwp_sema_t *sema);
int _lwp_sema_init(lwp_sema_t *sema, int count);
int _lwp_sema_post(lwp_sema_t *sema);
DESCRIPTION
Conceptually, a semaphore is an non-negative integer count that is atomically incremented and decremented. Typically this represents the
number of resources available. The _lwp_sema_init() function initializes the count, _lwp_sema_post() atomically increments the count, and
_lwp_sema_wait() waits for the count to become greater than 0 and then atomically decrements it.
LWP semaphores must be initialized before use. The _lwp_sema_init() function initializes the count associated with the LWP semaphore
pointed to by sema to count.
The _lwp_sema_wait() function blocks the calling LWP until the semaphore count becomes greater than 0 and then atomically decrements it.
The _lwp_sema_trywait() function atomically decrements the count if it is greater than zero. Otherwise it returns an error.
The _lwp_sema_post() function atomically increments the semaphore count. If there are any LWPs blocked on the semaphore, one is unblocked.
RETURN VALUES
Upon successful completion, 0 is returned. A non-zero value indicates an error.
ERRORS
The _lwp_sema_init(), _lwp_sema_trywait(), _lwp_sema_wait(), and _lwp_sema_post() functions will fail if:
EINVAL The sema argument points to an invalid semaphore.
EFAULT The sema argument points to an illegal address.
The _lwp_sema_wait() function will fail if:
EINTR The function execution was interrupted by a signal or fork(2).
The _lwp_sema_trywait() function will fail if:
EBUSY The function was called on a semaphore with a zero count.
The _lwp_sema_post() function will fail if:
EOVERFLOW The value of the sema argument exceeds SEM_VALUE_MAX.
SEE ALSO
fork(2)
SunOS 5.11 8 May 1998 _lwp_sema_wait(2)