The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Redirect grep output into file !!!!! hanu_oracle Shell Programming and Scripting 2 04-10-2008 09:02 AM
redirect the grep output into the variable mail2sant Shell Programming and Scripting 1 04-08-2008 09:46 AM
Redirect to variable MrAd UNIX for Dummies Questions & Answers 2 05-07-2007 04:18 PM
Redirect Output In Variable ZINGARO UNIX for Dummies Questions & Answers 1 08-02-2006 06:56 AM
please help: how to redirect input into a variable artur80 Shell Programming and Scripting 2 11-17-2002 10:18 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-07-2008
mail2sant mail2sant is offline
Registered User
  
 

Join Date: Apr 2008
Location: bangalore
Posts: 67
after grep i want to redirect it to some variable

for the below

grep -i $1 "${logdir}"* | grep -i adding | grep -iv equation | tail -1 | cut -d ':' -f 1

the result of the grep i want to redirect into some variable, i tried to do

veri=grep -i $1 "${logdir}"* | grep -i adding | grep -iv equation | tail -1 | cut -d ':' -f 1

but it is not working

please help me in that
  #2 (permalink)  
Old 04-07-2008
ag79 ag79 is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 33
vari=$(your_command_here)

or

vari=`your_command_here`

second example uses backticks, google it to learn more.
  #3 (permalink)  
Old 04-07-2008
denn denn is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 96
enclose in back quotes.
Code:
veri=`grep -i $1 "${logdir}"* | grep -i adding | grep -iv equation | tail -1 | cut -d ':' -f 1`
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:36 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0