Jumbled output in expect_out(buffer)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Jumbled output in expect_out(buffer)
# 1  
Old 02-26-2014
Jumbled output in expect_out(buffer)

I have a code like this :


Code:
set     ipv6_acl_max_chars  test_acl_max_chars123456a789%s%d2345678ww134rt789qa23456789012345%c89012%a56789012x4r67890test_acl_max_chars1234567890.01234aabcdob34567aBC0

spawn telnet $myip

expect "Login:" { send "admin\r" }
expect "Password:" {send "admin\r" }
expect $PROMP { send "ena\r" }
expect "Password:" {send "$enapass\r"}
expect $PROMPT2 { send "terminal length 0 \r" }
expect  $PROMPT2 { send "show ipv6 accounting access-list $ipv6_acl_max_chars interface TenGigabitEthernet 0/20 | grep ::/64 \r" }
expect $PROMPT2 { puts "buffer again : $expect_out(buffer) ### \n"
        send "interface range TenGigabitEthernet 0/6 , TenGigabitEthernet 0/8 , TenGigabitEthernet 0/7 , TenGigabitEthernet 0/5 , TenGigabitEthernet 0/3 , TenGigabitEthernet 0/1 , Port-channel 1 \r"
}
expect $PROMPT2 { puts "buffer again : $expect_out(buffer) ### \n" }
puts "\n ########### DONE ############# \n"

When this is executed, the expect_out(buffer) has jumbled characters and not readable.

Something like this :

#buffer again : show ipv6 accounting access-list test_acl_max_chars123456a789%s%d2345678ww134rt789qa23456789012345%c89012%a56789012x4r67890test_acl_m ax_chars1234567890.01234aabcdob34567aBC0 interface TenGigabit^[[194D ^[[197D$6 accounting access-list test_acl_max_chars123456a789%s%d2345678ww134rt789qa23456789012345%c89012%a56789012x4r67890test_acl_m ax_chars1234567890.01234aabcdob34567aBC0 interface TenGigabitEthernet^[[195D ^[[197D$ting access-list test_acl_max_chars123456a789%s%d2345678ww134rt789qa23456789012345%c89012%a56789012x4r67890test_acl_m ax_chars1234567890.01234aabcdob34567aBC0 interface TenGigabitEthernet 0/20 | ^[[195D ^[[197D$ess-list test_acl_max_chars123456a789%s%d2345678ww134rt789qa23456789012345%c89012%a56789012x4r67890test_acl_m ax_chars1234567890.01234aabcdob34567aBC0 interface TenGigabitEthernet 0/20 | grep ::/^[[195D ^[[197D$ test_acl_max_chars123456a789%s%d2345678ww134rt789qa23456789012345%c89012%a56789012x4r67890test_acl_m ax_chars1234567890.01234aabcdob34567aBC0 interface TenGigabitEthernet 0/20 | grep ::/64 ^M^M


Any clues and how to fix this ?

Regards,
Lucky

Moderator's Comments:
Mod Comment In this particular case I removed the code tags around the data sample after first adding them, since it would not offer a benefit..

Last edited by Scrutinizer; 02-26-2014 at 03:49 AM.. Reason: code tags also for data samples.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Trying to parse expect_out(buffer)

trying to telnet to a device, list the files, and delete them. I can get the script to telnet and log in OK, and even issue the command to list out the files. I can't figure out how to parse the expect_out(buffer) and extract the file name for use in the delete command. the files list out like... (4 Replies)
Discussion started by: imatinkerer
4 Replies

2. Programming

Flushing expect_out(buffer)

Can some one tell me how to flush expect_out(buffer)? below is my code expect -re {.*} {} expect "swpackages>*" send -i $con "trial.bat \r" set outcome $expect_out(buffer) expect "*continue*" set prevreport $expect_out(buffer) send "\r \r"; problem is :- I am getting "pre" stuffs... (0 Replies)
Discussion started by: cityprince143
0 Replies

3. Shell Programming and Scripting

Expect_out(buffer) works but it doesn't get all lines

Hello "expect" experts I am new at Expect. I have searched for a little while how to capture multiple lines with Expect and I am almost succeeded on that but I don't get all the lines of a command's output that the script executes on a server. Here is how my script works in a nutshell - ... (6 Replies)
Discussion started by: capacho6666
6 Replies

4. Programming

[SOLVED] Flushing expect_out(buffer) inside a loop

Greetings, Having an issue with the expect_out(buffer). in a foreach loop through some switches I am grabbing some arp table information and writing it out to output files (1 each for each switch looped through). The first iteration works fine. the second iteration of the loop writes the... (0 Replies)
Discussion started by: SuperSix4
0 Replies

5. UNIX for Dummies Questions & Answers

Vim external command output to new buffer

Hi, From inside Vim, I'm looking for a way to use the contents of the current buffer, pass it to an external executable, and then return the output from the executable into a new Vim buffer. I know that I can do something like %!<executable>, but that will overwrite the contents of the... (3 Replies)
Discussion started by: konfushus
3 Replies

6. Shell Programming and Scripting

expect_out buffer no such variable running script background

I am trying to use send and receive using expect. the expect_out(buffer) is working fine while it is running it as foreground. But the same script when it is ran as background, the expect_out(buffer) errored out. Is there any factor influence when we run script in foreground and in background? ... (0 Replies)
Discussion started by: shellscripter
0 Replies

7. Shell Programming and Scripting

expect_out(buffer) empty

I have only some info into my buffer, but after a rssi command I see the folowing lines expected into buffer but not present : rssi=-106 rssi=-109 I see in my buffer only the first part of the output, here you are a part of script : #!/usr/bin/expect -f #global expect_out match_max 10000000... (1 Reply)
Discussion started by: ugobale
1 Replies

8. Ubuntu

Ubuntu 8 SPARC edition problem jumbled text at install

hello guys i bought a SPARC neutra system a couple of months ago and after failing to install solaris onto it (and leaving it as a door stop for a couple of months) decided to stick ubuntu onto it for starters i dont own a sun keyboard i have a cheap pcline usb keyboard (it works... (3 Replies)
Discussion started by: garethmob
3 Replies

9. Shell Programming and Scripting

How to redirect the output to a buffer/clipboard ?

Hi, I was wondering if there is a way by which I can redirect the output of a command to the buffer so that if I do a Ctrl+v or Alt+v it should paste the data. Ex : cat myfile.txt | grep hello . Hello there 1 Hello there 2 The output of the file should go to the buffer(clipboard info) so... (1 Reply)
Discussion started by: preethgideon
1 Replies

10. Programming

buffer the output

Hai Friends I am writing a cgi program in C. The CGI program has a link to start my tcp chat server... The tcp chat server prints some information when it starts... I have captured the informations and sent to the client browser through the cgi program... But the output is displayed all... (6 Replies)
Discussion started by: collins
6 Replies
Login or Register to Ask a Question