• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Perl - quick help plus where to get more info - Edit: I'm so confused

reicherb

Platinum Member
I'm in need of quickly parsing out a few hundred lines from a 500,000 line log file. I know that this is an easy task with perl and if I remember back far enough grep was the way to do it.

The problem is I wasn't very good when I was working with perl and now it's been a while. Can anyone help me with this and possibly provide any good links you have that would help me start learning perl again?

Thanks.


Edit:

I just thought about it some more and realized that grep is just a shell command. I plan to do this on an NT box with Active perl installed. What is the best way to do it? I think I remember hearing about grep for windows or is perl the way to go?

Please help a poor confused soul.
 
one way would be to read the file in as an array, then loop through each element testing with a regex and saving the ones that match...

foreach $item (@array) {
if ($item =~ /something/) {
## save item
}
}
 
Try perlmonks.org (I think that's it) to get acquainted with perl.

grep would work, but it depends on what you want the final product to be. grep is an external command called from shell scripts, you'd have to script around it to format the output into something pretty, perl can do this fairly easily and when you move to a unix OS it can all go with you.
 
Back
Top