Sponsored Content
Full Discussion: Removing columns with dashes
Top Forums Shell Programming and Scripting Removing columns with dashes Post 302435551 by Xterra on Wednesday 7th of July 2010 04:07:47 PM
Old 07-07-2010
vgersh99

I have initiated 16 threads for different 'actions' that happen to be used for the same type of data (DNA). When I decide to start a thread is because I do not know how to go about it, otherwise, I would not post it. I have initiated 23 threads in total, most of them for shell scripting but not exclusively (Red Hat, Windows & DOS, etc). Is it against the rules to post questions that will be dealing with the same type of data? I could always change the format and get a solution that will work but I do not see a reason to do so.
Please advice
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

help removing dashes from social security number

I have a file containing social security numbers with the format ###-##-####. I need to read each record in this file, reformat the SSN to the format #########, and write the record with the reformatted SSN to a new file. I am a UNIX newbie. I think I need to use either the sed or awk commands, but... (2 Replies)
Discussion started by: Marcia P
2 Replies

2. Shell Programming and Scripting

removing spaces betweent columns

Hello Friends, Can any one help me with this issue: I would like to format a file: say if I have rows like: 4512 , SMITH , I-28984 ,, 4324 , 4343 42312 , SMITH , I-2EE8984 ,, 432E4E4 , 4343 I would like to have the output diaplayed like : 4512... (8 Replies)
Discussion started by: sbasetty
8 Replies

3. UNIX for Dummies Questions & Answers

Removing lines that are (same in content) based on columns

I have a file which looks like AA BB CC DD EE FF GG HH KK AA BB GG HH KK FF CC DD EE AA BB CC DD EE UU VV XX ZZ AA BB VV XX ZZ UU CC DD EE .... I want the script to give me only one line based on duplicate contents: AA BB CC DD EE FF GG HH KK AA BB CC DD EE UU VV XX ZZ (7 Replies)
Discussion started by: adsforall
7 Replies

4. UNIX for Dummies Questions & Answers

Removing columns of a file using vi Editor

Hi Experts, I have a file which looks like in this way 1 2233|A.K Shukla |G.M |Sales |12/12/52|6000 2 9876|Jai Sharma |Director |Production |12/03/50|67000 3 5678|Sumit Chakarborty |D.G.M |Marketing |19/04/43|6000 4 2365|Barun... (2 Replies)
Discussion started by: DilipPanda
2 Replies

5. Shell Programming and Scripting

Help removing lines with duplicated columns

Hi Guys... Please Could you help me with the following ? aaaa bbbb cccc sdsd aaaa bbbb cccc qwer as you can see, the 2 lines are matched in three fields... how can I delete this pupicate ? I mean to delete the second one if 3 fields were duplicated ? Thanks (14 Replies)
Discussion started by: yahyaaa
14 Replies

6. Shell Programming and Scripting

Removing blank columns from a file

Hi, I have a sample file as shown below -- id parent name dba -----------------------------------... (7 Replies)
Discussion started by: sumirmehta
7 Replies

7. Shell Programming and Scripting

Removing columns from awk '{ print $0 }'

I have a one-line command, lsusb | awk '{ $1=""; $2=""; $3=""; $4=""; $5=""; $6=""; print $0 }' It works, and gives the results I expect, I was just wondering if I am missing some easier way to nullify the first 6 column variables? Something like, lsusb | awk '{ $(1-6)=""; print $0 }' But... (10 Replies)
Discussion started by: AlphaLexman
10 Replies

8. Shell Programming and Scripting

Removing columns using awk

HI , I want to remove 5th and 6th column from a .csv file using awk.is there any way of this apart from writing the each field as below awk -F, '{print $1,$2,$3,$7......$100}' OFS=, infile. Thx, Deepti (4 Replies)
Discussion started by: gaur.deepti
4 Replies

9. Shell Programming and Scripting

Removing columns using awk

HI , I have a comma delimiter file, in which I want to remove 8th and 9th column. I tried removing those columns using the below code awk 'BEGIN { FS=","; OFS="," } {$8=$9="";gsub(",+",",",$0)}1' infile But the problem is 8th and 9th columns are user entered fields, theyvhave carriage... (1 Reply)
Discussion started by: mora
1 Replies

10. UNIX for Dummies Questions & Answers

Removing columns from a text file that do not have any values in second and third columns

I have a text file that has three columns. But at the end of the text file, there are trailing lines that have missing second and third columns: 4 0.04972604 KLHL28 4 0.0497332 CSTB 4 0.04979822 AIF1 4 0.04983331 DECR2 4 0.04990344 KATNB1 4 4 4 4 How can I remove the trailing... (3 Replies)
Discussion started by: evelibertine
3 Replies
threads(3)							      OpenSSL								threads(3)

NAME
CRYPTO_set_locking_callback, CRYPTO_set_id_callback, CRYPTO_num_locks, CRYPTO_set_dynlock_create_callback, CRYPTO_set_dynlock_lock_callback, CRYPTO_set_dynlock_destroy_callback, CRYPTO_get_new_dynlockid, CRYPTO_destroy_dynlockid, CRYPTO_lock - OpenSSL thread support SYNOPSIS
#include <openssl/crypto.h> void CRYPTO_set_locking_callback(void (*locking_function)(int mode, int n, const char *file, int line)); void CRYPTO_set_id_callback(unsigned long (*id_function)(void)); int CRYPTO_num_locks(void); /* struct CRYPTO_dynlock_value needs to be defined by the user */ struct CRYPTO_dynlock_value; void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value * (*dyn_create_function)(char *file, int line)); void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function) (int mode, struct CRYPTO_dynlock_value *l, const char *file, int line)); void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function) (struct CRYPTO_dynlock_value *l, const char *file, int line)); int CRYPTO_get_new_dynlockid(void); void CRYPTO_destroy_dynlockid(int i); void CRYPTO_lock(int mode, int n, const char *file, int line); #define CRYPTO_w_lock(type) CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) #define CRYPTO_w_unlock(type) CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) #define CRYPTO_r_lock(type) CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__) #define CRYPTO_r_unlock(type) CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__) #define CRYPTO_add(addr,amount,type) CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__) DESCRIPTION
OpenSSL can safely be used in multi-threaded applications provided that at least two callback functions are set. locking_function(int mode, int n, const char *file, int line) is needed to perform locking on shared data structures. (Note that OpenSSL uses a number of global data structures that will be implicitly shared whenever multiple threads use OpenSSL.) Multi-threaded applications will crash at random if it is not set. locking_function() must be able to handle up to CRYPTO_num_locks() different mutex locks. It sets the n-th lock if mode & CRYPTO_LOCK, and releases it otherwise. file and line are the file number of the function setting the lock. They can be useful for debugging. id_function(void) is a function that returns a thread ID, for example pthread_self() if it returns an integer (see NOTES below). It isn't needed on Windows nor on platforms where getpid() returns a different ID for each thread (see NOTES below). Additionally, OpenSSL supports dynamic locks, and sometimes, some parts of OpenSSL need it for better performance. To enable this, the following is required: o Three additional callback function, dyn_create_function, dyn_lock_function and dyn_destroy_function. o A structure defined with the data that each lock needs to handle. struct CRYPTO_dynlock_value has to be defined to contain whatever structure is needed to handle locks. dyn_create_function(const char *file, int line) is needed to create a lock. Multi-threaded applications might crash at random if it is not set. dyn_lock_function(int mode, CRYPTO_dynlock *l, const char *file, int line) is needed to perform locking off dynamic lock numbered n. Multi- threaded applications might crash at random if it is not set. dyn_destroy_function(CRYPTO_dynlock *l, const char *file, int line) is needed to destroy the lock l. Multi-threaded applications might crash at random if it is not set. CRYPTO_get_new_dynlockid() is used to create locks. It will call dyn_create_function for the actual creation. CRYPTO_destroy_dynlockid() is used to destroy locks. It will call dyn_destroy_function for the actual destruction. CRYPTO_lock() is used to lock and unlock the locks. mode is a bitfield describing what should be done with the lock. n is the number of the lock as returned from CRYPTO_get_new_dynlockid(). mode can be combined from the following values. These values are pairwise exclusive, with undefined behaviour if misused (for example, CRYPTO_READ and CRYPTO_WRITE should not be used together): CRYPTO_LOCK 0x01 CRYPTO_UNLOCK 0x02 CRYPTO_READ 0x04 CRYPTO_WRITE 0x08 RETURN VALUES
CRYPTO_num_locks() returns the required number of locks. CRYPTO_get_new_dynlockid() returns the index to the newly created lock. The other functions return no values. NOTES
You can find out if OpenSSL was configured with thread support: #define OPENSSL_THREAD_DEFINES #include <openssl/opensslconf.h> #if defined(OPENSSL_THREADS) // thread support enabled #else // no thread support #endif Also, dynamic locks are currently not used internally by OpenSSL, but may do so in the future. Defining id_function(void) has it's own issues. Generally speaking, pthread_self() should be used, even on platforms where getpid() gives different answers in each thread, since that may depend on the machine the program is run on, not the machine where the program is being compiled. For instance, Red Hat 8 Linux and earlier used LinuxThreads, whose getpid() returns a different value for each thread. Red Hat 9 Linux and later use NPTL, which is Posix-conformant, and has a getpid() that returns the same value for all threads in a process. A program compiled on Red Hat 8 and run on Red Hat 9 will therefore see getpid() returning the same value for all threads. There is still the issue of platforms where pthread_self() returns something other than an integer. This is a bit unusual, and this manual has no cookbook solution for that case. EXAMPLES
crypto/threads/mttest.c shows examples of the callback functions on Solaris, Irix and Win32. HISTORY
CRYPTO_set_locking_callback() and CRYPTO_set_id_callback() are available in all versions of SSLeay and OpenSSL. CRYPTO_num_locks() was added in OpenSSL 0.9.4. All functions dealing with dynamic locks were added in OpenSSL 0.9.5b-dev. SEE ALSO
crypto(3) 50 2013-03-05 threads(3)
All times are GMT -4. The time now is 02:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy