.:HSTuners::::Hondas Wanted:: |
04-16-2003, 12:22 AM | #1 |
Insomniac Moderator
Join Date: Aug 2001
Location: OR
Age: 43
Posts: 11,142
|
Please help with Perl program!
Here's all I know about the assignment:
/proc/net/dev - Identify how many ethernet devices that I have and identify which one is "upstream" by looking at the default route. example output: eth0 192.168.2.2 eth1 128.193.2.2 upstream Can anyone give me a hand here? I know a few of you are experienced with networks and programming. I've never touched perl before. Thanks
__________________
1994 Accord EX coupe --Need hosting for your pics on HST? PM me...-- |
04-16-2003, 02:41 AM | #2 |
Posts: n/a
|
good luck
|
04-16-2003, 10:18 AM | #3 |
Posts: n/a
|
Is this a school project or something???
I don't know enough about networking to be of too much assistance. I can help on a limited scale with specific perl questions, but usually I just go across the hall and get someone else to help me with the perl questions. b |
04-16-2003, 12:52 PM | #4 | |
Insomniac Moderator
Join Date: Aug 2001
Location: OR
Age: 43
Posts: 11,142
|
Quote:
Yeah it is :o
__________________
1994 Accord EX coupe --Need hosting for your pics on HST? PM me...-- |
|
04-16-2003, 07:58 PM | #5 |
Repost Wagon
Join Date: Dec 2001
Location: over here
Age: 44
Posts: 17,266
|
so that is under a unix/linux system right ???? well the number of ethernet devices is pretty simple to figure out: the last number +1.
__________________
|
04-16-2003, 08:07 PM | #6 | |
Insomniac Moderator
Join Date: Aug 2001
Location: OR
Age: 43
Posts: 11,142
|
Quote:
Yeah, its for *nix. I understand what you're saying, but that's assuming that the system always numbers the devices in order starting with 0. I think that's reasonable to assume, but I'll do a little research. Its due tomorrow morning :o
__________________
1994 Accord EX coupe --Need hosting for your pics on HST? PM me...-- |
|
04-16-2003, 09:22 PM | #7 |
Repost Wagon
Join Date: Dec 2001
Location: over here
Age: 44
Posts: 17,266
|
well from what i saw on my linux system (long time ago) every device starts with 0. the pimary hdd is blah blah/hdd0 the primary slave is blah blah/hdd2 and so forth.
__________________
|
04-17-2003, 10:52 AM | #8 |
Posts: n/a
|
hmm... not ethernet devices, though. I could run 2 cards on a solaris box as le0 and hme0. Count the unique IPs with your perl code to get the number of devices set. Not sure how to do so in perl, but essentially grep for "*.*.*.*", read number of lines without a comment hash before that pattern. get your output by redirecting lines from that file into another.
I think I could tcl it, but not perl. |
04-17-2003, 04:04 PM | #9 |
Insomniac Moderator
Join Date: Aug 2001
Location: OR
Age: 43
Posts: 11,142
|
I ended up using a complicated grep on /proc/net/dev to list the devices one per line. I then counted and displayed. Worked ok considering I'd never touched Perl before.
__________________
1994 Accord EX coupe --Need hosting for your pics on HST? PM me...-- |
Thread Tools | |
Display Modes | |
|
|