General discussion

Locked

perl script

By rjsaulakh ·
I have a log file of 10 MB size in which i have to find mac- address and there response status.what i do is first search through the file get all the mac -address and response status in a hash table . then i ask input from user for the mac address for which he want to see the response- status. the place where i require help is that how can i compare mac address and also how do i remove single quotes around a string

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by Jaqui In reply to perl script

this should help you code the script:

http://www.perl.com/pub/a/2004/10/14/file_editing.html

Collapse -

by solrak29 In reply to perl script

# removing single quotes from a string

# here are some options depending on what you want
# removes all quotes
$quotedstring =~ s/\'//g;

# removes beginning and end quotes
$quotedstring =~ s/^\'//;
$quotedstring =~ s/$\'//;

# comparing mac addresses

# I believe there is a better command
# called exists or something like that.
# but defined should work.
if ( defined $machash{$userrequest} )
{
return $machash{$userrequest};
}

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums