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
assigning nawk output to shell variable user_prady Shell Programming and Scripting 6 11-29-2007 04:01 AM
How to make nawk to set a shell variable rakeshou Shell Programming and Scripting 1 10-18-2007 02:33 AM
Passing a for loop variable into nawk Ant1815 UNIX for Dummies Questions & Answers 3 05-01-2007 09:56 AM
Passing PL/SQL variable value to Shell Varible ganapati Shell Programming and Scripting 10 01-31-2007 02:17 AM
passing value to shell variable trynew Shell Programming and Scripting 2 06-24-2002 02:13 PM

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-23-2008
wakhan wakhan is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 58
Passing shell variable to NAWK

I am trying to make a simple script in which i take input from shell and then forward the value to
nawk (BEGIN).

but when i run below mention script so it give no output.

Code:
echo "Enter TRUNK GROUP:"
read TGR

cat /omp-data/logs/5etr/080422.APX | nawk -F"|" -v P=$TGR '

BEGIN {

TG=P;

printf ("DATE IN ST EN  TGN ISEIZE ISATMP   IANS OATMPT   OVFL OSEIZE OSATMP   OANS TOTUSG OOSMTCE   OOS DBLSZR NTWCONG\n");
}


But when i run below code , so its work fine.


Code:
#echo "Enter TRUNK GROUP:"
#read TGR
#cat /omp-data/logs/5etr/080422.APX | nawk -F"|" -v P=$TGR '

cat /omp-data/logs/5etr/080422.APX | nawk'

BEGIN {

TG=700;

printf ("DATE IN ST EN  TGN ISEIZE ISATMP   IANS OATMPT   OVFL OSEIZE OSATMP   OANS TOTUSG OOSMTCE   OOS DBLSZR NTWCONG\n");
}


Can someone help me, to run the above code.
Plz Help
Regards
  #2 (permalink)  
Old 04-23-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,293
Double post questions is not allowed, please read the:

Simple rules of the UNIX.COM forums:

This is a similar question of your previous thread, if you have more questions about your problem, continue here:

NEW: need help with nawk using -v vars

Thread closed.
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 03:09 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