September 28, 2009

gawk command to telnet into a tcp server and issue a command

#!/usr/bin/gawk -f
BEGIN{
cmd="/inet/tcp/0/127.0.0.1/1800";
printf("showconfig\n") |& cmd;
printf("bye\n") |& cmd;
while ( (cmd |& getline) >0){
print $0;
}
close(cmd);
}

No comments:

Post a Comment