Sponsored Content
Top Forums Shell Programming and Scripting How to add subtotal and total according 3rd field mentioned below table? Post 302957824 by Corona688 on Thursday 15th of October 2015 01:07:46 PM
Old 10-15-2015
Your output looks inconsistent, sometimes using |, sometimes using spaces, sometimes having no separator at all. What do you actually want?

And what have you tried?
This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Get the total of a field in all the lines of a group

Hi I have a Fixed format data file where I need to to get the total of the field at certain position in a file for a group of lines. In this data file I need the total of all the field ats position 30:39 for each line starting with 6 and for each group startign with 5. Which means for... (27 Replies)
Discussion started by: appsguy616
27 Replies

2. Shell Programming and Scripting

Deleting every 3rd field using awk

I have a file whose format is like the following 350,2,16.2,195,2,8.0 every 3rd column of this file should be deleted. How can i achieve this tried with the following iostat -D -l 2 | /usr/xpg4/bin/awk ' NR>2 { for (i=0;i<=NF;i++)if(i%3==0)$i=""};' but no luck (3 Replies)
Discussion started by: achak01
3 Replies

3. Shell Programming and Scripting

Total records in table

Hi, I am having two tables. A & B I want to know the total number of records in each table and need to store each value in some variables to process further in the code. How it can be done ? With Regards (2 Replies)
Discussion started by: milink
2 Replies

4. Shell Programming and Scripting

Adding total of first field for each number in the second field

Dears, I need a script or command which can find the unique number from the second filed and against that number it adds the total of first field . 17215630 , 0 907043 ,1 201050 ,10 394149 ,4 1964 ,9 17215630, 0 907043 ,1 201050, 10 394149 ,4 1964 ,9 1234234, 55 23 ,100 33 ,67 ... (2 Replies)
Discussion started by: shary
2 Replies

5. Shell Programming and Scripting

only print line if 3rd field is 01

Similar question... I have a space delimited text file and I want to only print the lines where the 3rd word/field/column is equal to "01" awk '{if $3 = "01" print $0}' something like this. I meant to say: only print line IF 3rd field is 01 (2 Replies)
Discussion started by: ajp7701
2 Replies

6. Shell Programming and Scripting

Check a field in a table

I have made a table PRD_WORK_LM.test and it contains one field, ctrl_test. This field contains a 0 or a 1. I want to write a unix script that goes like this: IF ctrl_test = 1 THEN ... ELSE exit FI How can I write this in a script? Do I have to do this within bteq? or outside bteq? can... (5 Replies)
Discussion started by: katled
5 Replies

7. Solaris

3rd field in /etc/shadow

Searched and searched, but could not find a official answer. In Solaris, on a new server build, all the system accounts look like this: # cat /etc/shadow root:#########:6445:::::: daemon:NP:6445:::::: bin:NP:6445:::::: sys:NP:6445:::::: adm:NP:6445:::::: lp:NP:6445::::::... (6 Replies)
Discussion started by: flyddw
6 Replies

8. Shell Programming and Scripting

Need the output in the mentioned Table format

Hi Friends, I have the script output like below: Script Output: ----------------------------------------------------------------------- Details of the Client: ----------------------- name: server1; save set: All; ... (3 Replies)
Discussion started by: akmani
3 Replies

9. Shell Programming and Scripting

Calculate the total 4 field based on the conditions

Please help me to write a script Match with ACNO & NAME if it matched calculate the total val1 val2 val3 and val4 and GT is total of ACNO wise.please check the output Table ----------------- 1005|ANDP|ACN|20|50|10|30 1005|ANDP|ACN|20|10|30|40 1001|AND|NAC|40|50|40|50... (22 Replies)
Discussion started by: kalia4u
22 Replies

10. Shell Programming and Scripting

awk to calculate total and percent off field in file

Trying to use awk to print the lines in file that have either REF or SNV in $3, add a header line, sort by $4 in numerical order. The below code does that already, but where I am stuck is on the last part where the total lines are counted and printed under Total_Targets, under Targets_less_than is... (4 Replies)
Discussion started by: cmccabe
4 Replies
pthread_mutex_consistent_np(3C) 										   pthread_mutex_consistent_np(3C)

NAME
pthread_mutex_consistent_np - make a mutex consistent after owner death SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ library... ] #include <pthread.h> int pthread_mutex_consistent_np(pthread_mutex_t *mutex); The following applies only if the symbol _POSIX_THREAD_PRIO_INHERIT is defined, and for mutexes that have been initialized with the proto- col attribute having the value PTHREAD_PRIO_INHERIT. See pthread_mutexattr_getprotocol(3C). The mutex object referenced by mutex is made consistent by calling pthread_mutex_consistent_np(). A consistent mutex becomes inconsistent and is unlocked if its owner dies while holding it. A subsequent owner of the mutex will acquire the mutex with pthread_mutex_lock(3C), which will return EOWNERDEAD to indicate that the acquired mutex is inconsistent. The pthread_mutex_consistent_np() function should be called while holding the mutex acquired by a previous call to pthread_mutex_lock()that returned EOWNERDEAD. Since the critical section protected by the mutex could have been left in an inconsistent state by the dead owner, the caller should make the mutex consistent only if it is able to make the critical section protected by the mutex consistent. Calls to pthread_mutex_lock(), pthread_mutex_unlock(), and pthread_mutex_trylock() for a consistent mutex will behave in the normal manner. The behavior of pthread_mutex_consistent_np() for a mutex which is not inconsistent, or which is not held, is undefined. Upon successful completion, the pthread_mutexattr_consistent_np() function returns 0. Otherwise, an error number is returned to indicate the error. The pthread_mutex_consistent_np() function will fail if: ENOSYS The option _POSIX_THREAD_PRIO_INHERIT is not defined and the implementation does not support the function. The pthread_mutex_consistent_np() function may fail if: EINVAL The value specified by mutex is invalid, or the mutex does not have the appropriate attributes. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level | MT-Safe | +-----------------------------+-----------------------------+ pthread_mutex_lock(3C), pthread_mutexattr_getprotocol(3C), pthread_mutexattr_getrobust_np(3C), attributes(5), mutex(5), standards(5) 23 Mar 2005 pthread_mutex_consistent_np(3C)
All times are GMT -4. The time now is 07:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy