Computing.Net > Forums > Unix > awk script to perl

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

awk script to perl

Reply to Message Icon

Name: Carlos Picardal
Date: April 22, 2004 at 12:22:23 Pacific
OS: AIX 5.0
CPU/Ram: *****
Comment:

I need to convert this in to perl does anyone know how?

db=$1
dblist=listdb.txt
nodelist=node_directory.txt
servicelist=services.txt

awk -v find_db="$db" '
/Database name/ && find_db && $4 == find_db {
db_found = $4;
find_db = 0;
find_db_node = 1;
next;
}
/Node name/ && find_db_node {
node_found = $4;
find_db_node = 0;
find_node = $4;
next;
}
/Node name/ && find_node && $4 == find_node {
find_node = 0;
find_node_serv = 1;
next;
}
/Service name/ && find_node_serv {
service_found = $4;
find_node_serv = 0;
find_service = $4;
next;
}
find_service && $1 == find_service {
print " Port listing"
print " ------------"
print " "
print "Database name = " db_found
print "Node Name = " node_found
print "Service Name = " service_found
print "Port Number = " $2
exit;
}
' $dblist $nodelist $servicelist



Sponsored Link
Ads by Google

Response Number 1
Name: Dlonra
Date: April 22, 2004 at 13:29:35 Pacific
Reply:

man a2p


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: awk script to perl

How to call other shell/awk script www.computing.net/answers/unix/how-to-call-other-shellawk-script-/5571.html

tweaking William's awk script www.computing.net/answers/unix/tweaking-williams-awk-script/5174.html

pass 2 input files to awk script www.computing.net/answers/unix/pass-2-input-files-to-awk-script/4448.html