02-04-2020
Thank you very much
.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I]hi all
i am in confusion since last 2 days :(
i posted thraed yesterday and some friends did help but still i couldnt get solution to my problem
let it be very clear
i have a long log file of alkatel switch and i have to seperate the minor major and critical alarms shown by ! , !! and !!!... (6 Replies)
Discussion started by: nabmufti
6 Replies
2. Shell Programming and Scripting
If $1 in file1 matches $2 in file2. Then the value in $2 of file2 is updated to $1"."$2 of file2. The awk seems to only match the two files but not update. Thank you :).
awk
awk 'NR==FNR{A ; next} $1 in A { $2 = a }1' file1 file2
file1
name version
NM_000593 5
NM_001257406... (3 Replies)
Discussion started by: cmccabe
3 Replies
3. Shell Programming and Scripting
I am trying to match $1 in file1 with $2 in file2. If a match is found then $3 and $4 of file2 are copied to file1. Both files are tab-delimeted and I am getting a syntax error and would also like to update file1 in-place without creating a new file, but am not sure how. Thank you :).
file1
... (19 Replies)
Discussion started by: cmccabe
19 Replies
4. Shell Programming and Scripting
In the bash below the unique headers of each vcf.gz are stored in a text file with the same name. That is if 16-0000-file.vcf.gz was used the header text file would be 16-0000-file_header.txt.
There can be multiple vcf.gz in a directory, usually 3, that I need to fix the header in each file before... (6 Replies)
Discussion started by: cmccabe
6 Replies
5. Shell Programming and Scripting
I am trying to create a cronjob that will run on startup that will look at a list.txt file to see if there is a later version of a database using database.txt as the source. The matching lines are written to output.
$1 in database.txt will be in list.txt as a partial match. $2 of database.txt... (2 Replies)
Discussion started by: cmccabe
2 Replies
6. Shell Programming and Scripting
In the perl below I am trying to set/update the value of $14 (last field) in file2, using the matching NM_ in $12
or $9 in file2 with the NM_ in $2 of file1.
The lengths of $9 and $12 can be variable but what is consistent is the start pattern will always be NM_ and the end pattern is always
;... (4 Replies)
Discussion started by: cmccabe
4 Replies
7. Shell Programming and Scripting
In the awk, thanks you @RavinderSingh13, for the help in below, hopefully it is close as I am trying to update the value in $12 of the tab-delimeted file2 with the matching value in $1 of the space delimeted file1. I have added comments for each line as well. Thank you :).
awk
awk '$12 ==... (10 Replies)
Discussion started by: cmccabe
10 Replies
8. Shell Programming and Scripting
In the bash below which does execute I am trying to extract the contents of ${id} is 1234, as ${id} stores the variable that changes each time.
After the path is removed the contents of ${id} are stored in pref, so they can be used in the output. Currently I am not able to extract the 1234 in the... (6 Replies)
Discussion started by: cmccabe
6 Replies
9. Shell Programming and Scripting
In the awk below I am trying to use the file1 as a match to file2. In file2 the contents of $5,&6,and $7 (always tab-delimited) and are copied to the output under the header Quality metrics. The below executes but the output is empty. I have added comments to help and show my thinking. Thank you... (0 Replies)
Discussion started by: cmccabe
0 Replies
10. Shell Programming and Scripting
Trying to use awk to store the value of $5 in file1 in array x. That array x is then used to search $4 of file1 to find aa match (I use x to skip the header in file1). Since $4 can have multiple strings in it seperated by a , (comma), I split them and iterate througn each split looking for a match.... (2 Replies)
Discussion started by: cmccabe
2 Replies
LEARN ABOUT FREEBSD
sem_close
SEM_OPEN(3) BSD Library Functions Manual SEM_OPEN(3)
NAME
sem_open, sem_close, sem_unlink -- named semaphore operations
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <semaphore.h>
sem_t *
sem_open(const char *name, int oflag, ...);
int
sem_close(sem_t *sem);
int
sem_unlink(const char *name);
DESCRIPTION
The sem_open() function creates or opens the named semaphore specified by name. The returned semaphore may be used in subsequent calls to
sem_getvalue(3), sem_wait(3), sem_trywait(3), sem_post(3), and sem_close().
This implementation places strict requirements on the value of name: it must begin with a slash ('/') and contain no other slash characters.
The following bits may be set in the oflag argument:
O_CREAT Create the semaphore if it does not already exist.
The third argument to the call to sem_open() must be of type mode_t and specifies the mode for the semaphore. Only the S_IWUSR,
S_IWGRP, and S_IWOTH bits are examined; it is not possible to grant only ``read'' permission on a semaphore. The mode is modified
according to the process's file creation mask; see umask(2).
The fourth argument must be an unsigned int and specifies the initial value for the semaphore, and must be no greater than
SEM_VALUE_MAX.
O_EXCL Create the semaphore if it does not exist. If the semaphore already exists, sem_open() will fail. This flag is ignored unless
O_CREAT is also specified.
The sem_close() function closes a named semaphore that was opened by a call to sem_open().
The sem_unlink() function removes the semaphore named name. Resources allocated to the semaphore are only deallocated when all processes
that have the semaphore open close it.
RETURN VALUES
If successful, the sem_open() function returns the address of the opened semaphore. If the same name argument is given to multiple calls to
sem_open() by the same process without an intervening call to sem_close(), the same address is returned each time. If the semaphore cannot
be opened, sem_open() returns SEM_FAILED and the global variable errno is set to indicate the error.
The sem_close() and sem_unlink() functions return the value 0 if successful; otherwise the value -1 is returned and the global variable errno
is set to indicate the error.
ERRORS
The sem_open() function will fail if:
[EACCES] The semaphore exists and the permissions specified by oflag at the time it was created deny access to this process.
[EACCES] The semaphore does not exist, but permission to create it is denied.
[EEXIST] O_CREAT and O_EXCL are set but the semaphore already exists.
[EINTR] The call was interrupted by a signal.
[EINVAL] The sem_open() operation is not supported for the given name.
[EINVAL] The value argument is greater than SEM_VALUE_MAX.
[ENAMETOOLONG] The name argument is too long.
[ENFILE] The system limit on semaphores has been reached.
[ENOENT] O_CREAT is not set but the named semaphore does not exist.
[ENOSPC] There is not enough space to create the semaphore.
The sem_close() function will fail if:
[EINVAL] The sem argument is not a valid semaphore.
The sem_unlink() function will fail if:
[EACCES] Permission is denied to unlink the semaphore.
[ENAMETOOLONG] The specified name is too long.
[ENOENT] The named semaphore does not exist.
SEE ALSO
close(2), open(2), umask(2), unlink(2), sem_getvalue(3), sem_post(3), sem_trywait(3), sem_wait(3)
STANDARDS
The sem_open(), sem_close(), and sem_unlink() functions conform to ISO/IEC 9945-1:1996 (``POSIX.1'').
HISTORY
Support for named semaphores first appeared in FreeBSD 5.0.
BSD
January 9, 2010 BSD