Sponsored Content
Top Forums UNIX for Beginners Questions & Answers awk or sed to print the character from the previous line after the regexp match Post 303042166 by RudiC on Tuesday 17th of December 2019 06:35:44 AM
Old 12-17-2019
What did you try? What did you change? Where and how did it fail?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

print the line immediately after a regexp; but regexp is a sentence

Good Day, Im new to scripting especially awk and sed. I just would like to ask help from you guys about a sed command that prints the line immediately after a regexp, but not the line containing the regexp. sed -n '/regexp/{n;p;}' filename What if my regexp is 3 word or a sentence. Im... (3 Replies)
Discussion started by: ownins
3 Replies

2. Shell Programming and Scripting

Print previous, current and next line using sed

Hi, how can i print the previous, current and next line using sed? current line is the matching line. The following prints all lines containing 'Failure' and also the immediate next line cat $file | sed -n -e '/Failure/{N;p;}' Now, i also want to print the previous line too. Thanks,... (8 Replies)
Discussion started by: ysrinu
8 Replies

3. Shell Programming and Scripting

awk;sed appending line to previous line....

I know this has been asked before but I just can't parse the syntax as explained. I have a set of files that has user information spread out over two lines that I wish to merge into one: User1NameLast User1NameFirst User1Address E-Mail:User1email User2NameLast User2NameFirst User2Address... (11 Replies)
Discussion started by: walkerwheeler
11 Replies

4. Shell Programming and Scripting

How to use sed to search for string and Print previous two lines and current line

Hello, Can anybody help me to correct my sed syntax to find the string and print previous two lines and current line and next one line. i am using string as "testing" netstat -v | sed -n -e '/test/{x;2!p;g;$!N;p;D;}' -e h i am able to get the previous line current line next line but... (1 Reply)
Discussion started by: nmadhuhb
1 Replies

5. UNIX for Dummies Questions & Answers

Awk to print data from current and previous line

Hi guys, I have found your forum super useful. However, right now I am stuck on a seemingly "simple" thing in AWK. I have two columns of data, the first column in Age (in million years) and the second column is Convergence Rate (in mm/yr). I am trying to process my data so I can use it to... (2 Replies)
Discussion started by: awk_noob_456
2 Replies

6. Shell Programming and Scripting

awk, sed or perl regexp to print values from file

Hello all According to the following file (orignal one contains 200x times the same structure...) I was wondering if someone could help me to print <byte>??</byte> values example, running this script/command like ./script.sh xxapp I would expect as output: 102 116 112 ./script.sh xxapp2... (2 Replies)
Discussion started by: cabrao
2 Replies

7. Shell Programming and Scripting

Remove previous line if next & previous lines have same 4th character.

I want to remove commands having no output. In below text file. bash-3.2$ cat abc_do_it.txt grpg10so>show trunk group all status grpg11so>show trunk group all status grpg12so>show trunk group all status GCPKNYAIGT73IMO 1440 1345 0 0 94 0 0 INSERVICE 93% 0%... (4 Replies)
Discussion started by: Raza Ali
4 Replies

8. Shell Programming and Scripting

sed print first line before regexp and all lines after

Hi All I'm trying to extract the line just above a regexp and all lines after this. I'm currently doing this in two steps sed -n -e "/^+---/{g;p;}" -e h oldfile.txt > modified.txt sed -e "1,/^+---/d" -e "/^$/d" oldfile.txt >>modified.txt Sample sometext will be here sometext will be... (3 Replies)
Discussion started by: Celvin VK
3 Replies

9. Shell Programming and Scripting

awk script -print line when $2 > $2 of previous line

Hi all, From a while loop I am reading a sorted file where I want to print only the lines that have $1 match and $2 only when the difference from $2 from the previous line is > 30. Input would be like ... AN237 010 193019 0502 1 CSU Amoxycillin AN237 080 ... (2 Replies)
Discussion started by: gafoleyo73
2 Replies

10. AIX

Print nth previous line after match

Please help me print nth line after match awk or sed one line command. (3 Replies)
Discussion started by: sushma123
3 Replies
pthread_mutex_getprioceiling(3C)										  pthread_mutex_getprioceiling(3C)

NAME
pthread_mutex_getprioceiling, pthread_mutex_setprioceiling - change priority ceiling of a mutex SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ library... ] #include <pthread.h> int pthread_mutex_getprioceiling(const pthread_mutex_t *restrict mutex, int *restrict prioceiling); int pthread_mutex_setprioceiling(pthread_mutex_t *restrict mutex, int prioceiling, int *restrict old_ceiling); The pthread_mutex_getprioceiling() function returns the current priority ceiling of the mutex. The pthread_mutex_setprioceiling() function either locks the mutex if it is unlocked, or blocks until it can successfully lock the mutex, then it changes the mutex's priority ceiling and releases the mutex. When the change is successful, the previous value of the priority ceiling is returned in old_ceiling. The process of locking the mutex need not adhere to the priority protect protocol. If the pthread_mutex_setprioceiling() function fails, the mutex priority ceiling is not changed. The ceiling value should be drawn from the range of priorities for the SCHED_FIFO policy. When a thread acquires such a mutex, the policy of the thread at mutex acquisition should match that from which the ceiling value was derived (SCHED_FIFO, in this case). If a thread changes its scheduling policy while holding a ceiling mutex, the behavior of pthread_mutex_lock() and pthread_mutex_unlock() on this mutex is undefined. See pthread_mutex_lock(3C). The ceiling value should not be treated as a persistent value resident in a pthread_mutex_t that is valid across upgrades of Solaris. The semantics of the actual ceiling value are determined by the existing priority range for the SCHED_FIFO policy, as returned by the sched_get_priority_min() and sched_get_priority_max() functions (see sched_get_priority_min(3RT)) when called on the version of Solaris on which the ceiling value is being utilized. Upon successful completion, the pthread_mutex_getprioceiling() and pthread_mutex_setprioceiling() functions return 0. Otherwise, an error number is returned to indicate the error. The pthread_mutex_getprioceiling() and pthread_mutex_setprioceiling() functions will fail if: ENOSYS The option _POSIX_THREAD_PRIO_PROTECT is not defined and the system does not support the function. Since _POSIX_THREAD_PRIO_PROTECT is defined, this condition is not reported. The pthread_mutex_setprioceiling() function will fail if: EINVAL The mutex was not initialized with its protocol attribute having the value of PTHREAD_PRIO_PROTECT. The pthread_mutex_getprioceiling() and pthread_mutex_setprioceiling() functions may fail if: EINVAL The value specified by mutex does not refer to a currently existing mutex. ENOSYS The system does not support the priority ceiling protocol for mutexes. EPERM The caller does not have the privilege to perform the operation. The pthread_mutex_getprioceiling() function may fail if: EINVAL The priority requested by prioceiling is out of range. The pthread_mutex_setprioceiling() function may fail if: EINVAL The priority requested by prioceiling is out of range. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ pthread_mutex_init(3C), pthread_mutex_lock(3C), sched_get_priority_min(3RT), attributes(5), standards(5) 23 Mar 2005 pthread_mutex_getprioceiling(3C)
All times are GMT -4. The time now is 05:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy