![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Yellow Book assistance needed | FL1 | UNIX for Dummies Questions & Answers | 2 | 11-15-2007 04:04 PM |
| Script Needed Urgent in shell or PERL!!!!!!!!!!!!!!!!!!!! | aajan | Shell Programming and Scripting | 1 | 10-24-2007 05:28 AM |
| Perl script assistance; paste word into external command | bru | Shell Programming and Scripting | 10 | 02-23-2007 04:04 AM |
| Assistance needed. | 12yearold | UNIX for Dummies Questions & Answers | 4 | 07-07-2006 04:26 AM |
| NFS mount assistance needed... | Heron | UNIX for Dummies Questions & Answers | 2 | 03-21-2005 04:31 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Assistance needed with perl script
Ok, theres a log file containing the below. Lets call the logfile log_fantastic:
2009/03/16 21:42:45 USER: tonnabo - MAC: 0014BF2D385A - STATUS_ID: 30 - STATE: ERROR 2009/03/16 21:42:45 USER: tonnabo - MAC: 001310AC120D - STATUS_ID: 15 - STATE: OK 2009/03/16 21:42:45 USER: tonnabo - MAC: 001DD9277095 - STATUS_ID: 20 - STATE: ERROR I want to write a perl script that will read the contents of log_fantastic and output only the lines that does not have a status_id of 10? the below is what i've done. not sure if this is correct: use Data:: Dumper; main(); sub main { my @results; my $headers = "user, mac address, status_id"; my (@log_info, @dircontents); open (LOG, "</home/jhenson/log_fantastic"); @log_info = <LOG>; close (LOG); print Dumper("testing"); foreach my $content (@log_info) { chomp($content); my $line = substr ($content, -2); print Dumper($line); if ($line eq "OK") { push @dircontents, $content; } } #push @alarm_info, uc $headers; print Dumper(@dircontents); } |
|
||||
|
Quote:
oh theres more to it. i coulda easily done this through shell programming. but this needs to be done in perl. on top of grepping out the wanted status ids, i goto set it up in fields. thanks a million for your suggestion |
|
||||
|
Quote:
this works PERFECTLY. thanks a million. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|