The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
fuction return in perl jisha Shell Programming and Scripting 4 05-15-2008 05:51 AM
Help Help Help in recursion murtaza Shell Programming and Scripting 6 03-29-2007 11:26 AM
about memset fuction ranj@chn High Level Programming 3 01-31-2006 08:59 AM
Get Oracle fuction return value in a variable rahulrathod UNIX for Dummies Questions & Answers 3 04-14-2005 01:50 PM
recursion gsjf Shell Programming and Scripting 1 08-26-2002 01:22 AM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 02-08-2008
varungupta varungupta is offline
Registered User
  
 

Join Date: Feb 2007
Location: Pune, Dehradun (INDIA), Michigan(US)
Posts: 206
Exclamation awk and fuction (recursion) !! Urgent !!

Hey all,

Could you please check following way of writing awk is correct or not ???

-----------------------------------------------------------

Quote:
pattern= "mqsi[admtspr]"

cat tempgrep.txt | \
while read ppid
do
awk '{
recurcive_fun(ppid, pattern)
function recurcive_fun(n, pattern)
{
awk '{ if ($2~n && $1~pattern){
n=$3
recurcive_fun(n, pattern)}
else{
if ($2~n && $1!~pattern){
print $1 >> "tempmail.txt"
break
}
else {next}
}
}' tempfind.txt
}
}'
done
-----------------------------------------------------------------

Its recursion being called.

tempgrep.txt has :
462948
1311040
880922

tempfind.txt has :
t2589vg 880922 462948 09:57:07 -ksh
mqsiadm 1298856 1311040 09:57:56 -ksh
mqsiadm 1311040 880922 09:57:19 -ksh

Please suggust/correct the script(if wrong) !!
Thanks
Varun

Last edited by varungupta; 02-08-2008 at 03:39 PM..
 

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 01:40 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