The UNIX and Linux Forums  

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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
print variable in file using awk kamel.seg Shell Programming and Scripting 3 01-03-2008 02:43 AM
use variable for sed print line atchleykl UNIX for Dummies Questions & Answers 2 04-24-2007 09:44 AM
can awk print column using a variable ?? jambesh Shell Programming and Scripting 36 09-26-2006 04:39 AM
print the name of variable sun-guy Shell Programming and Scripting 1 08-06-2006 02:03 PM
print variable in awk kazanoova2 Shell Programming and Scripting 8 05-17-2004 03:30 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-14-2008
Registered User
 

Join Date: Jan 2008
Location: Bangalore,India
Posts: 132
Stumble this Post!
Arrow How to print a value in the variable using awk ?

Hi All,

I have a part of a script below:

var1="value1"
awk 'BEGIN {printf("%36s \n ","value1")}'

Instead of directly giving the "value1" , I need to give using "var1" in the above awk statement.

Is this possible?
If so, what is the modified awk command?

Thanks in advance
JS
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 01-14-2008
Klashxx's Avatar
HP-UX/Linux/Oracle
 

Join Date: Feb 2006
Location: Almerķa, Spain
Posts: 371
Stumble this Post!
Same logic that the other example:
Code:
awk 'BEGIN {printf("%36s \n ","'"${var1}"'")}'
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:40 AM.


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