Sponsored Content
Full Discussion: Condition on Fields
Top Forums Shell Programming and Scripting Condition on Fields Post 302972804 by am24 on Wednesday 11th of May 2016 02:12:53 AM
Old 05-11-2016
Hi Rudi,

I have also tried a similar kind of code but i faced a problem in checking for any of the fields in (5,6,7,8) is blank.

However the code given by you solved my problem. It worked perfectly fine.

A big ton of thanks to you.

Regards,
am24
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk sed cut? to rearrange random number of fields into 3 fields

I'm working on formatting some attendance data to meet a vendors requirements to upload to their system. With some help on the forums here, I have the data close. But they've since changed what they want. The vendor wants me to submit three fields to them. Field 1 is the studentid field,... (4 Replies)
Discussion started by: axo959
4 Replies

2. HP-UX

Difference between [condition] and [[condition]] and ((condition)) when used with if condition

Executed the following if conditions .. and got different results . only (( )) gave correct o/p with all scenarios . Can anybody please let me know what is the difference between and ] and ((condition)) when used with if condition. And why each condition gave different result. 1.... (2 Replies)
Discussion started by: soumyabubun
2 Replies

3. Shell Programming and Scripting

redirect stdout echo command in condition A run in condition B

hi, I have some problems in my simple script about the redirect echo stdout command inside a condition. Why is the echo command inside the elif still execute in the else command Here are my simple script After check on the two diff output the echo stdout redirect is present in two diff... (3 Replies)
Discussion started by: jao_madn
3 Replies

4. Shell Programming and Scripting

If condition return 0 even when it fails to satisfy te condition

HI My doubt may be basic one but I need to get it clarified.. When i use "if" condition that checks for many AND, OR logical conditions like if ]; then return 0 fi Even the if condition fails it returns as zero.. Any clue.. But if i add else condition like if ]; ... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies

5. Shell Programming and Scripting

How to print 1st field and last 2 fields together and the rest of the fields after it using awk?

Hi experts, I need to print the first field first then last two fields should come next and then i need to print rest of the fields. Input : a1,abc,jsd,fhf,fkk,b1,b2 a2,acb,dfg,ghj,b3,c4 a3,djf,wdjg,fkg,dff,ggk,d4,d5 Expected output: a1,b1,b2,abc,jsd,fhf,fkk... (6 Replies)
Discussion started by: 100bees
6 Replies

6. Shell Programming and Scripting

awk - compare 1st 15 fields of record with 20 fields

I'm trying to compare 2 files for differences in a selct number of fields. When differnces are found it will write the whole record of the second file including appending '|C' out to a delta file. Each record will have 20 fields, but only want to do comparison of 1st 15 fields. The 1st field of... (7 Replies)
Discussion started by: sljnk
7 Replies

7. Shell Programming and Scripting

Join fields in a same file based on condition

I have an input file like this... All iI want to do is If the lines are identical except for the last field i want to merge them into single line input_file I feel something is nothing I feel something is everything apple mango banana apple mango grapes I want to get output like this:... (3 Replies)
Discussion started by: raj_k
3 Replies

8. Shell Programming and Scripting

awk sort based on difference of fields and print all fields

Hi I have a file as below <field1> <field2> <field3> ... <field_num1> <field_num2> Trying to sort based on difference of <field_num1> and <field_num2> in desceding order and print all fields. I tried this and it doesn't sort on the difference field .. Appreciate your help. cat... (9 Replies)
Discussion started by: newstart
9 Replies

9. Shell Programming and Scripting

Print . in blank fields to prevent fields from shifting

The below code works great, kindly provided by @Don Cragun, the lines in bold print the current output. Since some of the fields printed can be blank some of the fields are shifted. I can not seem too add . to the blank fields like in the desired output. Basically, if there is nothing in the field... (10 Replies)
Discussion started by: cmccabe
10 Replies

10. UNIX for Beginners Questions & Answers

Is there a UNIX command that can compare fields of files with differing number of fields?

Hi, Below are the sample files. x.txt is from an Excel file that is a list of users from Windows and y.txt is a list of database account. $ head -500 x.txt y.txt ==> x.txt <== TEST01 APP_USER_PROFILE USER03 APP_USER_PROFILE TEST02 APP_USER_EXP_PROFILE TEST04 APP_USER_PROFILE USER01 ... (3 Replies)
Discussion started by: newbie_01
3 Replies
PTHREAD_MUTEXATTR(3)					     Library Functions Manual					      PTHREAD_MUTEXATTR(3)

NAME
pthread_mutexattr_init, pthread_mutexattr_destroy, pthread_mutexattr_settype, pthread_mutexattr_gettype - mutex creation attributes SYNOPSIS
#include <pthread.h> int pthread_mutexattr_init(pthread_mutexattr_t *attr); int pthread_mutexattr_destroy(pthread_mutexattr_t *attr); int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int kind); int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *kind); DESCRIPTION
Mutex attributes can be specified at mutex creation time, by passing a mutex attribute object as second argument to pthread_mutex_init(3). Passing NULL is equivalent to passing a mutex attribute object with all attributes set to their default values. pthread_mutexattr_init initializes the mutex attribute object attr and fills it with default values for the attributes. pthread_mutexattr_destroy destroys a mutex attribute object, which must not be reused until it is reinitialized. pthread_mutexattr_destroy does nothing in the LinuxThreads implementation. LinuxThreads supports only one mutex attribute: the mutex kind, which is either PTHREAD_MUTEX_FAST_NP for ``fast'' mutexes, PTHREAD_MUTEX_RECURSIVE_NP for ``recursive'' mutexes, or PTHREAD_MUTEX_ERRORCHECK_NP for ``error checking'' mutexes. As the NP suffix indicates, this is a non-portable extension to the POSIX standard and should not be employed in portable programs. The mutex kind determines what happens if a thread attempts to lock a mutex it already owns with pthread_mutex_lock(3). If the mutex is of the ``fast'' kind, pthread_mutex_lock(3) simply suspends the calling thread forever. If the mutex is of the ``error checking'' kind, pthread_mutex_lock(3) returns immediately with the error code EDEADLK. If the mutex is of the ``recursive'' kind, the call to pthread_mutex_lock(3) returns immediately with a success return code. The number of times the thread owning the mutex has locked it is recorded in the mutex. The owning thread must call pthread_mutex_unlock(3) the same number of times before the mutex returns to the unlocked state. The default mutex kind is ``fast'', that is, PTHREAD_MUTEX_FAST_NP. pthread_mutexattr_settype sets the mutex kind attribute in attr to the value specified by kind. pthread_mutexattr_gettype retrieves the current value of the mutex kind attribute in attr and stores it in the location pointed to by kind. RETURN VALUE
pthread_mutexattr_init, pthread_mutexattr_destroy and pthread_mutexattr_gettype always return 0. pthread_mutexattr_settype returns 0 on success and a non-zero error code on error. ERRORS
On error, pthread_mutexattr_settype returns the following error code: EINVAL kind is neither PTHREAD_MUTEX_FAST_NP nor PTHREAD_MUTEX_RECURSIVE_NP nor PTHREAD_MUTEX_ERRORCHECK_NP AUTHOR
Xavier Leroy <Xavier.Leroy@inria.fr> SEE ALSO
pthread_mutex_init(3), pthread_mutex_lock(3), pthread_mutex_unlock(3). LinuxThreads PTHREAD_MUTEXATTR(3)
All times are GMT -4. The time now is 12:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy