Sponsored Content
Top Forums Shell Programming and Scripting Output of a Grep(Which already has a variable) into a Variabale Post 302788207 by baranisachin on Monday 1st of April 2013 09:04:27 AM
Old 04-01-2013
I noticed that and changed, But u were too fast Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

capturing the output of grep as integer variable

Hi, I have an expression using grep and nawk that captures the ID number of a given Unix process. It gets printed to screen but I don't know how to declare a variable to this returned value! For example, ps -ef|grep $project | grep -v grep | nawk '{print $2}' This returns my number. How... (2 Replies)
Discussion started by: babariba
2 Replies

2. Shell Programming and Scripting

redirect the grep output into the variable

i want to redirect the grep output into the variable but i am not able to get it i tried veri=`grep -i $1 "${logdir}"* | grep -i adding | grep -iv equation | tail -1 | cut -d ':' -f 1` vari=$(grep -i $1 "${logdir}"* | grep -i adding | grep -iv equation | tail -1 | cut -d ':' -f 1) BUT NOT... (1 Reply)
Discussion started by: mail2sant
1 Replies

3. Shell Programming and Scripting

Put the output of grep in a variable

Hi, in a shell script how can I put the result of a grep command in a variable : myvariable=grep mystring myfilename Thank you. (3 Replies)
Discussion started by: big123456
3 Replies

4. Shell Programming and Scripting

Problem with assigning output of grep + awk to a variable

Hi All, I am getting the output for the following command when i run it on the unix console. --------------------------- grep `whoami` /etc/passwd | awk '{print ($1);}' | cut -d ":" -f3 ---------------------------- But i made it into a script and tried to print the variable, its... (5 Replies)
Discussion started by: meheretoknow
5 Replies

5. Shell Programming and Scripting

ENV Variabale changes are not retained

ENV varibles set using a script are not retailed once the script execution is done. But if the same ENV variable is set in command line, it is retained. Consider the below case $ cat ti export MDS_CODE_HOME=`pwd` echo $MDS_CODE_HOME rsamadde@pcasvs04 ~/R2ANew $ ti... (3 Replies)
Discussion started by: gogol
3 Replies

6. Shell Programming and Scripting

declaring a variabale as string type

I know that directly we can assign a string to a variable but is there any other way to declare a variable as string type. I am using tcsh shell where I am using a function which would return a value of string type but when I am using return keyword , it is returning only integer value.pls help. (3 Replies)
Discussion started by: maitree
3 Replies

7. Shell Programming and Scripting

using awk for setting variable but change the output of this variable within awk

Hi all, Hope someone can help me out here. I have this BASH script (see below) My problem lies with the variable path. The output of the command find will give me several fields. The 9th field is the path. I want to captured that and the I want to filter this to a specific level. The... (6 Replies)
Discussion started by: Cowardly
6 Replies

8. Shell Programming and Scripting

How to grep the desired output and output to a file?

currently I have process from a raw file to this stage ALTER TABLE "EXCEL_ADMIN"."TC_TXN_VOID" ADD CONSTRAINT "PK_TC_TXN_VOID" PRIMARY KEY ("TC_TXN_IID") ALTER TABLE "EXCEL_ADMIN"."TC_TXN_AMT" ADD CONSTRAINT "PK_TC_TXN_AMT" PRIMARY KEY ("TC_TXN_AMT_IID") ALTER TABLE... (10 Replies)
Discussion started by: jediwannabe
10 Replies

9. UNIX for Dummies Questions & Answers

How to have the output in grep?

Hi guys - I am trying to have a certain file display information horizontally divided by a pipe. for example file name: foo.dat has information like this: name1 name2 name3 namenamename4 namene5 I would like it to display like this: name1|name2|name3|namenamename4|namene5 ... (6 Replies)
Discussion started by: DallasT
6 Replies

10. UNIX for Advanced & Expert Users

Passing variable as input & storing output in other variable

I have a below syntax its working fine... var12=$(ps -ef | grep apache | awk '{print $2,$4}') Im getting expected output as below: printf "%b\n" "${VAR12}" dell 123 dell 456 dell 457 Now I wrote a while loop.. the output of VAR12 should be passed as input parameters to while loop and results... (5 Replies)
Discussion started by: sam@sam
5 Replies
FUTEX(7)						     Linux Programmer's Manual							  FUTEX(7)

NAME
futex - fast user-space locking SYNOPSIS
#include <linux/futex.h> DESCRIPTION
The Linux kernel provides futexes ("Fast user-space mutexes") as a building block for fast user-space locking and semaphores. Futexes are very basic and lend themselves well for building higher level locking abstractions such as POSIX mutexes. This page does not set out to document all design decisions but restricts itself to issues relevant for application and library develop- ment. Most programmers will in fact not be using futexes directly but instead rely on system libraries built on them, such as the NPTL pthreads implementation. A futex is identified by a piece of memory which can be shared between different processes. In these different processes, it need not have identical addresses. In its bare form, a futex has semaphore semantics; it is a counter that can be incremented and decremented atomi- cally; processes can wait for the value to become positive. Futex operation is entirely user space for the noncontended case. The kernel is involved only to arbitrate the contended case. As any sane design will strive for noncontention, futexes are also optimized for this situation. In its bare form, a futex is an aligned integer which is touched only by atomic assembler instructions. Processes can share this integer using mmap(2), via shared memory segments or because they share memory space, in which case the application is commonly called multi- threaded. Semantics Any futex operation starts in user space, but it may be necessary to communicate with the kernel using the futex(2) system call. To "up" a futex, execute the proper assembler instructions that will cause the host CPU to atomically increment the integer. Afterward, check if it has in fact changed from 0 to 1, in which case there were no waiters and the operation is done. This is the noncontended case which is fast and should be common. In the contended case, the atomic increment changed the counter from -1 (or some other negative number). If this is detected, there are waiters. User space should now set the counter to 1 and instruct the kernel to wake up any waiters using the FUTEX_WAKE operation. Waiting on a futex, to "down" it, is the reverse operation. Atomically decrement the counter and check if it changed to 0, in which case the operation is done and the futex was uncontended. In all other circumstances, the process should set the counter to -1 and request that the kernel wait for another process to up the futex. This is done using the FUTEX_WAIT operation. The futex(2) system call can optionally be passed a timeout specifying how long the kernel should wait for the futex to be upped. In this case, semantics are more complex and the programmer is referred to futex(2) for more details. The same holds for asynchronous futex wait- ing. VERSIONS
Initial futex support was merged in Linux 2.5.7 but with different semantics from those described above. Current semantics are available from Linux 2.5.40 onward. NOTES
To reiterate, bare futexes are not intended as an easy to use abstraction for end-users. Implementors are expected to be assembly literate and to have read the sources of the futex user-space library referenced below. This man page illustrates the most common use of the futex(2) primitives: it is by no means the only one. SEE ALSO
futex(2) Fuss, Futexes and Furwocks: Fast Userlevel Locking in Linux (proceedings of the Ottawa Linux Symposium 2002), futex example library, futex-*.tar.bz2 <ftp://ftp.kernel.org/pub/linux/kernel/people/rusty/>. COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2012-08-05 FUTEX(7)
All times are GMT -4. The time now is 04:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy