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
FIAIF-SCAN(8)					      Administration and Privileged Commands					     FIAIF-SCAN(8)

NAME
fiaif-scan - print syslog entries in human readable form SYNOPSIS
fiaif-scan [ -n ] [ -m ] DESCRIPTION
fiaif-scan reads lines from STDIN and prints to STDOUT, in human readable form, any packets found (standard syslog format is assumed). Each log message is parsed based on the configuration files at the time fiaf-scan is run. The idea is to enable the user to quickly iden- tify which zone rule is causing the packet to be logged, and how to change this, if necessary. OPTIONS
-n Don't do a reverse lookup of IP addresses or ports; display them as numbers. This reduces the number of host lookups and speeds up scanning. -m print the MAC address on each line. EXAMPLE
fiaf-scan -n </var/log/messages Scan from the current system log and display any packets on the console. Don't look up names for IP addressses or ports; just show the numbers. FILES
/etc/fiaif/fiaif.conf AUTHOR
Anders Fugmann <anders(at)fugmann.net> BUGS
The program has been tested only with messages from the standard syslog. It may work on lines from ulogd, but this has not been tested. Bash may not be the fastest parser in the world. Expect this software to be slow. (40 lines per sec on a K6-II/300Mhz without name lookups). Please report other bugs to <fiaif@fiaif.net>. SEE ALSO
fiaif.conf(5), zone.conf(5), iptables(8), syslog(3) Linux Feb 2003 FIAIF-SCAN(8)