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
Find cmd not working as expected Vishal123 Shell Programming and Scripting 6 08-29-2007 02:11 AM
#/usr/bin/csh -f not working as expected? effigy Shell Programming and Scripting 4 06-05-2006 05:00 PM
ls not working as expected within ksh GNMIKE Shell Programming and Scripting 10 07-07-2005 07:53 AM
awk not working as expected with BIG files ... videsh77 Shell Programming and Scripting 1 02-24-2005 04:15 PM
which not working as expected osee Shell Programming and Scripting 2 09-07-2004 11:37 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-13-2006
videsh77 videsh77 is offline
Registered User
  
 

Join Date: Aug 2004
Posts: 144
Var substitution in awk - not working as expected

countA=`awk '/X/''{print substr($0,38,1)}' fName | wc -l`
countB=`wc -l fName | awk '{print int($1)}'`
echo > temp
ratio=`awk -va=$countA -vc=$countB '{printf "%.4f", a/c}' temp`

After running script for above I am getting an error as :

awk: 0602-533 Cannot find or open file -vc=25.
The source line number is 1.


Same kind of script is working elsewhere. Not sure why its going wrong.
  #2 (permalink)  
Old 01-13-2006
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
This might have something to do with which awk you are using. Try using nawk instead of awk in your script - especially if it is Solaris.
  #3 (permalink)  
Old 01-13-2006
videsh77 videsh77 is offline
Registered User
  
 

Join Date: Aug 2004
Posts: 144
I am using AIX environment.
  #4 (permalink)  
Old 01-13-2006
linuxpenguin's Avatar
linuxpenguin linuxpenguin is offline Forum Advisor  
Registered User
  
 

Join Date: May 2002
Location: India
Posts: 295
did nawk work ? also try gawk
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 10:44 AM.


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