[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



> Code: 400 Time: 23:51:04 UTC 05-MAY-2005 SN: 00824 Version: 1.42
  Promedica Bixby Medical Center - 818 Riverside Avenue Adrian Mi

I use Expect on the file handle to check for that data.

$location_regex = "Code: 400
([[:print:]])*([[:cntrl:]])+([[:print:]])*([[:cntrl:]])+";
push @triggers, cook_regex(undef, $location_regex, "LOCATION");


Here is execution of expect:
my (undef, $error) = $exp->expect(0, @triggers);

So if Expect sees two lines of data that starts with 'Code: 400' Then
self->match will have the text that caused the match.

Output:
[cfowler at ze1250 gk]$  sudo  ./gk.pl -p /dev/ttyS1 -o DEMO -v -D 3 -f SH
05-06 12:02:27 Initilizing Modem.
05-06 12:02:27 Modem initialized.
05-06 12:02:33 Incoming call. Answering..
05-06 12:02:44 Call answered.
05-06 12:02:47 Found: Code: 400 Time: 23:51:04 UTC 05-MAY-2005 SN: 00824
Version: 1.42
05-06 12:02:47   Promedica Bixby Medical Center - 818 Riverside Avenue
Adrian Mi
05-06 12:02:47 Location information received.
05-06 12:02:55 Call Terminated.
05-06 12:02:56 Initilizing Modem.
05-06 12:02:56 Modem initialized.


I need to somehow extract the location information from the second line.
I know that it has leading spaces.  I want all the text after the
leading spaces.  I do not know if the first lines ends in '\n','\m' or
'\r\n' so that is why in the POSIX regex I used ([[:cntrl:]])+ to detect
the end of the first and second lines so I can get them both.

Can someone tell me that if I have a string that looks like this

"Code: 400 Time: 23:51:04 UTC 05-MAY-2005 SN: 00824 Version: 1.42
  Promedica Bixby Medical Center - 818 Riverside Avenue Adrian Mi"

and based on the knows above how I can extract all the data past the
leading spaces on the second line?  Also is there a better regex I can
use for Expect?

Thanks,
Chris 


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00080.html">[ale] Learning CSS by example</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00082.html">[ale] Superblock recovery - Revisited</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00079.html">[ale] cygwin package for nm?</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00092.html">[ale] Extracting a second line</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00081"><strong>Date</strong></a></li>
<li><a href="threads.html#00081"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>