[Chicago-talk] regural expression question?
Richard Reina
richard at rushlogistics.com
Thu Mar 30 06:34:31 PST 2006
I have a little script that finds the line which contains a six digit number begining with 1 or greater. I know that $_ represents the line, however, I am having trouble figuring out how to save that number once it's found (without everything else in the line).
#!/usr/bin/perl -w
@ARGV = "/home/richard/test/out.txt";
while (<>) {
if ( /\b[123456789][0-9][0-9][0-9][0-9][0-9]\b/ ) {
print "Found\n" . $_ . "\n";
}
}
Any help would be greatly appreciated.
Thanks,
Richard
A people that values its privileges above its principles soon loses both.
-Dwight D. Eisenhower.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20060330/099fb14e/attachment.html
More information about the Chicago-talk
mailing list