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
c function calling from a pearl script jisha Shell Programming and Scripting 2 04-02-2008 02:50 AM
Help needed to Keep calling a function after every 5 seconds. nua7 Shell Programming and Scripting 11 03-25-2008 05:08 AM
calling one function from another shell script trichyselva UNIX for Dummies Questions & Answers 1 01-16-2008 09:28 PM
urgent calling function from a script jisha Shell Programming and Scripting 2 01-09-2008 11:40 AM
calling c++ function from script Lebamb High Level Programming 3 06-24-2003 06:53 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-15-2008
Registered User
 

Join Date: Jan 2008
Location: Bangalore,India
Posts: 138
Help needed in function calling in a script

Hi ,

I have a script as shown below:

rpttxt()
{
name="$*"
awk '/'"${name}"'/ {print $2 $3"=" $4}' file.txt

}

xx = rpttxt "COL_HEAD_1"
awk 'BEGIN {printf("%36s \n ","'"$xx"'")}'

rpttxt() is a function..I want to store the final result of this function in the variable "xx" and print this in a specific format..
When i run this script i get an error : line 8: xx: command not found
Is their any error in calling the function ..?

Thanks in advance

JS
Reply With Quote
Forum Sponsor
  #2  
Old 01-15-2008
Registered User
 

Join Date: Jan 2008
Location: Bangalore,India
Posts: 138
I have solved it
Condiser the thread closed..
Thanks
JS
Reply With Quote
  #3  
Old 01-15-2008
Registered User
 

Join Date: Jul 2007
Posts: 76
Good that you solved it but, it is better to post that how did you solve it...! Atleast the next one like me (dumb) will get to know the solution :-)

Thanks in advance.

-ilan
Reply With Quote
  #4  
Old 01-15-2008
Registered User
 

Join Date: Jan 2008
Location: Bangalore,India
Posts: 138
The script is :
rpttxt()
{
name="$*"
awk '/'"${name}"'/ {print $2 $3"=" $4}' file.txt

}

xx = rpttxt "COL_HEAD_1"
awk 'BEGIN {printf("%36s \n ","'"${xx}"'")}'



Actually the problem was with my file.txt It had got some quotes in it due to which the script didnt run properly.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:30 AM.


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

Content Relevant URLs by vBSEO 3.2.0