Answer the question
In order to leave comments, you need to log in
snmpwalk - stop output?
How to limit snmpwalk output? The problem is that you can’t get by with the usual grep, tail, head, because snmpwalk returns several thousand lines, and I need the first 50, for example. Until it reads everything, the script is no longer executed.
Answer the question
In order to leave comments, you need to log in
So your problem is not in the heads and tails, they work fine. And the fact that they cut, as they were told, 50-100 lines, and snmpwalk does not end after that, but continues to honestly generate content that you no longer need.
Here is about the same difference as between
cat big_file | head -10
and Here is a visual test with a half-
gig head -10 big_file
text file for you:
$ time cat test > /dev/null
real 0m6.708s
$ time cat test | tail -10 > /dev/null
real 0m6.297s
$ time tail -10 test > /dev/null
real 0m0.007s
(snmpawlk | head -50 & ) ; sleep сколько_там_надо_времени_нагенерить_50_строк+запас ; killall snmpwalk
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question