From: Matt Z. <mzagrabe@d.umn.edu> - 2008-01-28 23:15:26
|
Greetings, First, you should not start a new thread by replying to another and changing the subject. On Mon, 2008-01-28 at 10:52 -0600, ESRY, DONALD H, JR. (DON), ATTGNS wrote: > Hi All, >=20 > I want to login to a bunch of routers and log the output of some show > commands. Is there a way to prepend each line of output with the router > name? >=20 > I'm using:=20 > $exp->log_file($outfile); >=20 > Is there a way to tell log_file to start each line with some defined > text? Is there an alternative? Instead of logging to a file, log to a subroutine and have the subroutine prepend specific output as desired. $exp->log_file(\log_expect); sub log_expect { my $match =3D shift; $match =3D~ s/^/router-name/; print FILE $match; } * This is all from memory and guessing. Use at your own risk. Cheers, --=20 Matt Zagrabelny - mzagrabe@d.umn.edu - (218) 726 8844 University of Minnesota Duluth Information Technology Systems & Services PGP key 1024D/84E22DA2 2005-11-07 Fingerprint: 78F9 18B3 EF58 56F5 FC85 C5CA 53E7 887F 84E2 2DA2 He is not a fool who gives up what he cannot keep to gain what he cannot lose. -Jim Elliot |