Chris Cappelletti wrote:
> I have a 10 gig log file; I currently go through the log looking at
> specific fields and do stuff with the particular rows based on certain
> conditions. Each row has 12 columns. The only columns that I need are
> column 6 and 8. Each column is delimited by “somedata”. So an example
> row would look like:
>
> “column1” “column2” “column3” “column4” “column5” “column6” “column7”
> “column8” “column9” “column10” “column11” “column12”
>
> What would be the most optimal way to see if the word “pink” was in
> column 6 and “blue” was in column 8? Keep in mind that pink or blue
> could appear anywhere else in this line.
Untested:
foreach (@row_of_data) {
my @flds = split;
if ($flds[5] eq '"pink"' and $flds[7] eq '"blue"') {
# found one
}
}
--
,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED]
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs