The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
redirect the grep output into the variable mail2sant Shell Programming and Scripting 1 04-08-2008 06:46 AM
Redirect output mpang_ Shell Programming and Scripting 1 08-15-2007 05:57 AM
awk redirect output to shell variable dhinge Shell Programming and Scripting 3 12-09-2006 08:11 AM
redirect output of FTP kcaluwae Shell Programming and Scripting 4 06-23-2005 05:45 AM
redirect command output to variable hugow UNIX for Dummies Questions & Answers 1 06-22-2005 03:43 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-02-2006
Registered User
 

Join Date: Jul 2006
Posts: 36
Redirect Output In Variable

how make assign the output of the command (for example: grep "file" "string" ) in a variable ($name)?

i thing how put the result of the command (grep , cut, find ecc) in a variable..

IT's Possible ??
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 08-02-2006
tayyabq8's Avatar
UNIX Hobbyist
 

Join Date: Nov 2004
Location: /World/Asia/MiddleEast/Kuwait/Salmiya
Posts: 513
Use backquotes `` to assign output of a command to a var, like this:
Code:
$ a=`grep "WINDOWS" str2`
$ echo $a
test line WINDOWS test line
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:32 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0