[TriLUG] Perl. Help. Needed.
Greg Brown
gwbrown1 at gmail.com
Wed Mar 11 21:35:38 EDT 2009
Well I nearly gave up; I'll get this thing fixed proper and tell the group
how I did it but I need a working example by 9 am tomorrow so what I did was
turn logging on for the full Expect.pm portion then I created a hostname-raw
file. From there I'll strip out the needless stuff ('show run' is nice
enough to provide beginning and end markers) and I'll call that a partial
success.
Thanks to all who helped!!
Greg
On Wed, Mar 11, 2009 at 4:08 PM, Greg Brown <gwbrown1 at gmail.com> wrote:
> Ah...
>
> printing to stdout
> tclsh
> rtpndsefwl5324d2(tcl)#AGAIN!!!! printing to stdout
>
> So when STDOUT is redirect in Perl the prints to $ssh end up in the output
> file and not sent to the Expect module. Interesting.
>
> Yeah, I'm going to have to figure out a way to assign a CONFIG handle to
> that one $ssh->expect command and grab that from there.
>
> On Wed, Mar 11, 2009 at 3:52 PM, William Sutton <william at trilug.org>wrote:
>
>> Hmm... so print CONFIG the stuff you want in the CONFIG file, print STDERR
>> the stuff you want on your screen, and let Expect use STDOUT?
>>
>> William Sutton
>>
>>
>> On Wed, 11 Mar 2009, Greg Brown wrote:
>>
>> Hum... and when you redirect STDOUT it appears that the expect commands
>>> stop
>>> communicating from the script to the Expect.pm process. Interesting.
>>>
>>> On Wed, Mar 11, 2009 at 3:42 PM, Greg Brown <gwbrown1 at gmail.com> wrote:
>>>
>>> Yes, that's true, I could do that but that would capture the entire
>>>> output
>>>> for the script which is quite involved; capturing only the desired
>>>> output
>>>> would be much more clean.
>>>>
>>>> But I'm about ready to write some "------MARK------" lines into the file
>>>> and strip out everything outside those marks.
>>>>
>>>> But that's a last resort. This can be done.. somehow.
>>>>
>>>> Greg
>>>>
>>>>
>>>> On Wed, Mar 11, 2009 at 3:38 PM, <shawn.taylor at gpi.com> wrote:
>>>>
>>>> I am by no means a perl or expect guru, but why can't you do something
>>>>> like:
>>>>>
>>>>> ./script.pl > myfile.out
>>>>>
>>>>> Since the script uses the expect module, there should be no required
>>>>> user
>>>>> interaction no?
>>>>>
>>>>> Shawn
>>>>>
>>>>> Greg Wrote:
>>>>>
>>>>> Let me step back and take a breather.. how do I redirect the output of
>>>>> this
>>>>> command:
>>>>>
>>>>> print $ssh "exec \"show run\"\r";
>>>>>
>>>>> I think I've tried everything. I'm open to any and all suggestions.
>>>>> --
>>>>> TriLUG mailing list :
>>>>> http://www.trilug.org/mailman/listinfo/trilug
>>>>> TriLUG FAQ : http://www.trilug.org/wiki/Frequently_Asked_Questions
>>>>>
>>>>>
>>>>
>>>> --
>>> TriLUG mailing list :
>>> http://www.trilug.org/mailman/listinfo/trilug
>>> TriLUG FAQ : http://www.trilug.org/wiki/Frequently_Asked_Questions
>>>
>>> --
>> TriLUG mailing list :
>> http://www.trilug.org/mailman/listinfo/trilug
>> TriLUG FAQ : http://www.trilug.org/wiki/Frequently_Asked_Questions
>>
>
>
More information about the TriLUG
mailing list