Expect: Parsing/evaluating lines of numbers


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Expect: Parsing/evaluating lines of numbers
# 1  
Old 09-13-2007
Expect: Parsing/evaluating lines of numbers

There *has* to be an elegant way to do this in Expect...

I have a command that returns lines of numbers. Like:

prompt% mycommand --loop=5
9 4956 4951 4951 4956
9 4960 4951 4951 4956
9 4956 4951 4951 4956
9 4956 4951 4951 4956
9 4956 4951 4951 4956
prompt%

All numbers must be inside a given interval (eg. 4900-5000 in the case
above). If they are not I must report which column that has the number
outside the interval (column 0 above).

I could start a lot of bash and/or C programming, but I would rather
keep it all in the Expect script that I am using to invoke the command
from anyway.

Any suggestions?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Print lines with numbers only.

Is there other way then this only solution I have found to print lines with numbers only? file.txtone two three 3 four five 5tt 6gfjdfgdf 9 66 six 0 seven 7 eight 546546 gffdg445gfg fd644 (7 Replies)
Discussion started by: Jotne
7 Replies

2. Shell Programming and Scripting

Deleting all lines containing numbers

Hi guys I have a text file in the following format what i would like ot do is iterate through the file deleting the lines containing only numbers. I have googled this and have been unable to find any help ( maybe its my search terms) so if any one an give me a heads up i would... (3 Replies)
Discussion started by: dunryc
3 Replies

3. Shell Programming and Scripting

Parsing expect_out using regex in expect script

Hi, I am trying to write an expect script. Being a newbie in expect, maybee this is a silly doubt but i am stuck here. So essentially , i want the o/p of one router command to be captured . Its something like this Stats Input Rx : 1234 Input Bytes : 3456 My expect script looks ... (5 Replies)
Discussion started by: ashy_g
5 Replies

4. Shell Programming and Scripting

TCL expect out string with multiple lines

Hello, I will be sending this command to a specific COMID: exp_send-i $COMID "fdisk -l | grep Disk | awk '{print $2}'" The command will produce this output: /dev/sda /dev/sdb etc.. the problem is how do I store the output in a variable in TCL, I am currently using this to grab the... (1 Reply)
Discussion started by: h0ujun
1 Replies

5. UNIX for Dummies Questions & Answers

Parsing file, reading each line to variable, evaluating date/time stamp of each line

So, the beginning of my script will cat & grep a file with the output directed to a new file. The data I have in this file needs to be parsed, read and evaluated. Basically, I need to identify the latest date/time stamp and then calculate whether or not it is within 15 minutes of the current... (1 Reply)
Discussion started by: hynesward
1 Replies

6. Shell Programming and Scripting

print lines containing only numbers

Hi boys, I have a txt file with a lot of lines. It have lines containing mostly only numbers but some of them contain numbers mixed with special characters and or letters or space.. its look like this: 271261621371 2727127f 27126|71372. ... Do you have any ideas of the easiest way to... (3 Replies)
Discussion started by: alekkz
3 Replies

7. Shell Programming and Scripting

Expect: Block of lines should be executed only if access succeeds

Hello I'm using expect to create a script. I want some lines to be executed only if the telnet succeeds to the target host. Kindly check the code that i created. The problem i'm facing that while execting the script, the lines after login seems to be ignored. The password is not sent and also... (2 Replies)
Discussion started by: Hossam_Nox
2 Replies

8. Shell Programming and Scripting

expect - How to ignore empty lines?

Hi all, I'm looking for a way to generate an error when a command does not print an expected message. For example : test.sh : echo hi!test.exp : exp_internal 1 spawn ./test.sh expect { "hi!" {puts "bingo!"} "*" {puts "error!" ; exit 1} } I expected test.exp to match the string... (2 Replies)
Discussion started by: whbos
2 Replies

9. Shell Programming and Scripting

How to remove all lines with something other than numbers

Hi, How would I get rid of lines having something else than numbers (such as tabs,white space, special characters, empty line, letters). So I have big file with numers as follows: 12345678901 23456789012 32343678901 42345638901 52345678901 and I sometimes the file might contain some... (2 Replies)
Discussion started by: Juha
2 Replies

10. Shell Programming and Scripting

Parsing Lines from a text file

Hello Guru's I know there are people who live to be able to help people like me. That's why I'm here! I have a text file that has a corresponding address information that I need to be able to get maybe as a Unix Function. The text file contains the following: AIX17_JB_C;... (3 Replies)
Discussion started by: sallender
3 Replies
Login or Register to Ask a Question
TGN(1)																	    TGN(1)

NAME
tgn - a network traffic generator SYNOPSIS
tgn [-V] [-v] [-l] [-s random seed] [-w PCAP filename] [-o output speaker] [-c packet count] [-h] [PDU definition] DESCRIPTION
tgn is a network traffic generator. It is command-line interface (CLI) program that does the same thing as the send_network command of the Network Expect framework. Refer to nexp(1) for additional details regarding the send_network command. The only mandatory option is a PDU definition. The -c switch allows to specify the number of packets to send. If -c is not provided then the number of packets to send is calculated automatically based on the PDU definition. -V causes tgn to print its version number and exit. The -s flag allows to specify a random seed that will cause predicatibility of pseudo-random numbers generated by tgn during execution of a script. In cases where tgn is used as a protocol fuzzer, this option is useful to be able to re-generate a specific test case. -v increases the verbosity level. Additional information may be displayed when the verbosity level is higher. The -l flag causes tgn to display all available network speakers and exit. See nexp(1) for a discussion of network speakers. The -o flag allows to select a specific network speaker for output. Use the -l option to list available speakers. By default, the "ip" speaker (kernel-routed IP packet delivery) is tried first and if it is not available, which can happen if tgn is not run with root privileges, the "hex" speaker is used. The PDU definition is a string that defines a PDU. It uses libpbuild PDU syntax. EXAMPLES
shell# tgn -o eth0 "ip(dst = 192.168.1.1)/icmp-echo(id = 'random')" shell# tgn "ip(src = 192.168.0.1, dst = <192.168.0.10, 192.168.0.11>,ttl = <1, 2>)/" "tcp(src = 'random', dst = 22..25, window = 16384,syn, seq = 'random', ack-seq = 0)" shell# tgn -w /tmp/cap -c 5 "ether()/ip(dst = 1.2.3.4++)/icmp-echo(seq = 0++)" && wireshark /tmp/cap BUGS
tgn has not been ported to Microsoft Windows. VERSION
This man page is correct for version 1.0 of tgn. SEE ALSO
nexp-numspec(1), nexp-payload(1), nexp-ether(5), nexp-gre(5), nexp-ip(5), nexp-mpls(5), nexp(1) AUTHOR
Network Expect was written by Eloy Paris <peloy@netexpect.org>. However, Network Expect borrows ideas from lots of Open Source tools like Nemesis, Packit, hping, Expect, and Scapy. The Network Expect author is indebted to the authors of these tools for their contribution. This man page was written by Eloy Paris. 09 September 2009 TGN(1)