calling a method inside awk


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting calling a method inside awk
# 1  
Old 11-24-2009
calling a method inside awk

Hi All,

How do we call a method existing in another file inside awk.

After matching a pattern i want to call a method secureCopy that exists in another file, but method not getting called:


Code:
ls -l |
awk  -v var2=$servername -v var1=$srcserverpath -v var3=$tgtpath '
/File19112009Name[0-9]+\.xml$/ {
   printf ("abhinav");
   printf ($NF);
 >> method call-->>  secureCopy var2 var1 $NF var3 $NF;
   printf ("dikshit");
}'



---------- Post updated at 07:33 AM ---------- Previous update was at 07:10 AM ----------

From my next post i will definitely use code tags

Last edited by Franklin52; 11-24-2009 at 08:30 AM.. Reason: Please use code tags!
# 2  
Old 11-24-2009
Use the system command, something like:

Code:
system("secureCopy " var2 " " var1 " " $NF " " var3 " " $NF )

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to duplicate rows using awk or any other method?

I want to duplicate each row in my file Egfile.txt Name State Age Jack NJ 34 John MA 23 Jessica FL 45 I want the code to produce this output Name State Age Jack NJ 34 Jack NJ 34 John MA 23 John MA 23 Jessica FL 45 Jessica FL 45 (6 Replies)
Discussion started by: sidnow
6 Replies

2. Shell Programming and Scripting

Calling one script inside another

Hi, I am calling a script log.sh from output.sh. Log.sh has below pice of code: IFILE=/home/home1/Report1.csv if awk -F, '$6==0 && $7==0{exit 1}' ${IFILE} then awk -F, ' BEGIN{ c=split("1,6,2,3,4,5,6", col) print "To: abc@gmail.com" print "Subject: Error... (2 Replies)
Discussion started by: Vivekit82
2 Replies

3. Shell Programming and Scripting

Calling a function in cpp file inside shell script

Hi I need to call a function written in a cpp file with arguments inside the shell script..Can anyone help me how to do this:( (1 Reply)
Discussion started by: rkrish
1 Replies

4. Shell Programming and Scripting

Calling array inside awk

Hello I have the file df.tmp FS is actually the / FS but escape character\ and end of line $ is used in order to fetch exctly / and not other filesystems. awk '/\/$/ {print $(NF-1)+0}' df.tmp will work properly and return a value eg. 60 but when I am trying to issue the command with the array... (3 Replies)
Discussion started by: drbiloukos
3 Replies

5. Shell Programming and Scripting

Calling Java Method from UNIX using shell script

Hi All, I need to call a java method from a shell script. I know we can use the command java ClassName to call the main method in it. But I need to call another method that is there in the class and pass an email to it. Can I use java ClassName.MethodName(email) Any help will be... (4 Replies)
Discussion started by: RahulK
4 Replies

6. Shell Programming and Scripting

for loop, calling and editing multiple files inside

hey guys, I'm trying to call and modify multiple files inside the for loop, i can't get it to work... ------------------------ AFILE=/dir/a_file.txt BFILE=/dir/b_file.txt CFILE=/dir/c_file.txt ADESTFILE=/dir/a_dest_file.txt BDESTFILE=/dir/b_dest_file.txt... (6 Replies)
Discussion started by: DeuceLee
6 Replies

7. UNIX for Advanced & Expert Users

calling external values inside awk command

I have a code as follows awk ' BEGIN{FS=OFS=","} { n=split($3,a1,"~") split($4,a2,"~") split($5,a3,"~") for(i=1;i<=n;i++) { print $1,$2,a1,a2,a3,date } }' file In the above code I need to add current date(date). How is this possible to call an date or a exported value... (13 Replies)
Discussion started by: tkbharani
13 Replies

8. Shell Programming and Scripting

calling function inside awk

Hi All, My 1.txt contains some functions fun1() .... .... fun2() .... .... I can call these fun from 2.txt inside awk as below value="`fun1 "argument1"`" awk 'BEGIN {printf ("%s", "'"$value"'")}' I need to modify the above code so that without using the variable to store... (2 Replies)
Discussion started by: jisha
2 Replies

9. UNIX for Advanced & Expert Users

Unix Machine for calling Native Method of C

hi all i have a unix machine (FBD). I have Also installed java of Version (j2sdk1.4.1_07) on unix machine. Now i want to Call C Native function in Java Which is declared as Native. i am doing this by following steps: 1) Making Echo.java File Which is having The following lines of code.... (5 Replies)
Discussion started by: sbeyonduf007
5 Replies

10. Shell Programming and Scripting

calling a C executable from inside a Perl script

here's the Perl code snippet... how can i call my C executable 'porter-stemmer' and pass it $1 as an argument? Thanks for the help! # Read through the original topic set, and modify based on the current # pre-processing options while (<TOPIC_ORIG>) { # Run pre-processing over only the... (3 Replies)
Discussion started by: mark_nsx
3 Replies
Login or Register to Ask a Question