02-26-2008
The final thing I was wondering was, how would I have to alter the code to make it work on something that has a lot of such patterns. I mean a series of SUBJECT, COMMENT, LENGTH::SUBJECT, COMMENT, LENGTH and each being regarded as one chunk...
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have written a script to test some isdn links in my network and I am trying to format the output to be more readable. Each line of the output has a different number of digits as follows...
Sitename , spid1 12345678901234 1234567890 1234567 , spid2 1234567890 1234567890 1234567
Sitename , ... (1 Reply)
Discussion started by: drheams
1 Replies
2. Shell Programming and Scripting
hi,
i want to extract the sessionID from this line.
QnA Session Id :
here the output should be--
QnA_SessionID=128589
Thanks
NT (3 Replies)
Discussion started by: namishtiwari
3 Replies
3. Shell Programming and Scripting
Hi guys,
as per subject I am having problem with regular expressions.
Example, if i got a string "javax.servlet.http.HttpServlet.service" that may occurred anywhere within a text file.
How can I used the negate pattern matching of regular expression?
I tried the below pattern but it... (4 Replies)
Discussion started by: DrivesMeCrazy
4 Replies
4. Shell Programming and Scripting
In Perl I can write a condition that evaluates a match expression like this:
if ($foo =~ /^bar/) {
do blah blah blah
}
How do I write this in shell? What I need to know is what operator do I use? The '=~' doesn't seem to fit. I've tried different operators, I browsed the man page for... (3 Replies)
Discussion started by: indiana_tas
3 Replies
5. Shell Programming and Scripting
Hi,
I have a variable in my script that gets its value from a procstack output. It could be a number of any length, or it could just be a '1' with 0 or more white spaces around it. I would like to detect when this variable is just a 1 and not a 1234, for example. This is as far as I got:
... (3 Replies)
Discussion started by: tmf33uk
3 Replies
6. Shell Programming and Scripting
I trying to match the begining of the following line in a perl script with a regular expression.
$ENV{'ORACLE_HOME'}
I tried this regluar expession:
/\$ENV\{\'ORACLE_HOME\'\}/
Instead of match, I got a blank prompt >
It seems to be a problem with the single quote. If I take it... (11 Replies)
Discussion started by: JC9672
11 Replies
7. Shell Programming and Scripting
I am completely new to perl programming. My father is helping me learn said programming language. However, I am stuck on one of the assignments he has given me, and I can't find very much help with it via google, either because I have a tiny attention span, or because I can be very very dense.
... (4 Replies)
Discussion started by: kittyluva2
4 Replies
8. Programming
Hi all,
How am I read a file, find the match regular expression and overwrite to the same files.
open DESTINATION_FILE, "<tmptravl.dat" or die "tmptravl.dat";
open NEW_DESTINATION_FILE, ">new_tmptravl.dat" or die "new_tmptravl.dat";
while (<DESTINATION_FILE>)
{
# print... (1 Reply)
Discussion started by: jessy83
1 Replies
9. UNIX for Dummies Questions & Answers
I have a very large file (over 700 million lines) that has some lines that I need to delete. An example of 5 lines of the file:
HS4_80:8:2303:19153:193032 153 k80:138891
HS4_80:8:2105:5544:43174 89 k88:81949
165 k88:81949 323 0 * = 323 0 ... (6 Replies)
Discussion started by: pathunkathunk
6 Replies
10. Shell Programming and Scripting
Hi
Consider the file
this is a good line
when running
grep '\b(good|great|excellent)\b' file5
I expect it to match the line but it doesn't... what am i doing wrong??
(ultimately this regex will be in a awk script- just using grep to test it)
Thanks,
Storms (5 Replies)
Discussion started by: Storms
5 Replies
LEARN ABOUT DEBIAN
test::data::scalar
Scalar(3pm) User Contributed Perl Documentation Scalar(3pm)
NAME
Test::Data::Scalar -- test functions for scalar variables
SYNOPSIS
use Test::Data qw(Scalar);
DESCRIPTION
This modules provides a collection of test utilities for scalar variables. Load the module through Test::Data.
Functions
blessed_ok( SCALAR )
Ok if the SCALAR is a blessed reference.
defined_ok( SCALAR )
Ok if the SCALAR is defined.
undef_ok( SCALAR )
Ok if the SCALAR is undefined.
dualvar_ok( SCALAR )
Ok if the scalar is a dualvar.
How do I test this?
sub dualvar_ok ($;$) { my $ok = Scalar::Util::dualvar( $_[0] ); my $name = $_[1] || 'Scalar is a dualvar';
$Test->ok( $ok, $name );
$Test->diag("Expected a dualvar, didn't get it
")
unless $ok;
}
greater_than( SCALAR, BOUND )
Ok if the SCALAR is numerically greater than BOUND.
length_ok( SCALAR, LENGTH )
Ok if the length of SCALAR is LENGTH.
less_than( SCALAR, BOUND )
Ok if the SCALAR is numerically less than BOUND.
maxlength_ok( SCALAR, LENGTH )
Ok is the length of SCALAR is less than or equal to LENGTH.
minlength_ok( SCALAR, LENGTH )
Ok is the length of SCALAR is greater than or equal to LENGTH.
number_ok( SCALAR )
Ok if the SCALAR is a number ( or a string that represents a number ).
At the moment, a number is just a string of digits. This needs work.
number_between_ok( SCALAR, LOWER, UPPER )
Ok if the number in SCALAR sorts between the number in LOWER and the number in UPPER, numerically.
If you put something that isn't a number into UPPER or LOWER, Perl will try to make it into a number and you may get unexpected
results.
string_between_ok( SCALAR, LOWER, UPPER )
Ok if the string in SCALAR sorts between the string in LOWER and the string in UPPER, ASCII-betically.
readonly_ok( SCALAR )
Ok is the SCALAR is read-only.
ref_ok( SCALAR )
Ok if the SCALAR is a reference.
ref_type_ok( REF1, REF2 )
Ok if REF1 is the same reference type as REF2.
strong_ok( SCALAR )
Ok is the SCALAR is not a weak reference.
tainted_ok( SCALAR )
Ok is the SCALAR is tainted.
(Tainted values may seem like a not-Ok thing, but remember, when you use taint checking, you want Perl to taint data, so you should
have a test to make sure it happens.)
untainted_ok( SCALAR )
Ok if the SCALAR is not tainted.
weak_ok( SCALAR )
Ok if the SCALAR is a weak reference.
TO DO
* add is_a_filehandle test
* add is_vstring test
SEE ALSO
Scalar::Util, Test::Data, Test::Data::Array, Test::Data::Function, Test::Data::Hash, Test::Builder
SOURCE AVAILABILITY
This source is in Github:
http://github.com/briandfoy/test-data/tree/master
AUTHOR
brian d foy, "<bdfoy@cpan.org>"
COPYRIGHT AND LICENSE
Copyright (c) 2002-2009 brian d foy. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2009-02-12 Scalar(3pm)