@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet


Comments:

<0> Hej.
<1> hi there, could somebody please explain why this script always returns equals values for total_upload and total_download variables? http://rafb.net/p/CQkLyK60.html
<2> http://members.iinet.net.au/~userbob/duck.jpg <- look at this duck
<2> b0fh_ua: thats crappy code
<2> whats it should do
<2> b0fh_ua: tell me, i do a new one
<1> {xmb}: sorry, I'm new to awk ;)
<2> its easy
<2> show me how the input shows like
<2> some example



<1> in genral I need to calculate upload/download stats for each local IP address, in log files generated by ipacct
<1> 1 sec
<2> ipacct ****s i think
<2> use iptables patchset
<2> netfilter
<1> http://rafb.net/p/Z4Rhe053.html
<1> I need to figure all traffic which comes from/to IP addresses in 10.0.1.0/24 zone, but to/from outside that zone
<1> i'e calculate only external traffic
<2> which value is i/o
<1> 1-st column is source address, 3-d is destination, 7-th - is amount of bytes
<1> i need to get stts for each IP and grand total for all ip addresses
<1> *stats
<1> {xmb}: regarding ipacct - i'd like to use it as netgraph module, much less overhead for my FreeBSD ;)
<2> b0fh_ua: something like xmb.ath.cx/code/small-short/ipacct.awk
<1> wow
<1> {xmb}: what about grand total?
<2> do it in the data gathering part
<2> refresh the script
<1> {xmb}: okay, but how to add condition if i don't want to calculate traffic inside local network, i'e if destination address is 10.0.something?
<1> for your script looks like it will calculate everything?
<2> revert the match
<2> it will only calculate for 10.0
<1> okay, for calculating I need to be sure $1 is inside 10.0 and $3 - outside, how sould I combine these conditions?
<1> with ($1 ~ /10.0/) && !($3 ~ /10.0/) ?
<2> for example i guess
<2> shoulod work
<1> http://rafb.net/p/TYxBdB90.html
<1> something like this?
<1> {xmb}: thank you for help!
<2> speech speaking ****s
<3> :)
<3> don't like your own voice :)
<4> compare previous $1, if equal ignore, else print: awk '{if(NR==1){cur=$1;print;next}if($1!=cur){print};cur=$1}' howto compare previous $1, if equal print, else ignore?
<3> what are you trying to do
<4> compare previous $1, if $1 in next line is equal print the line, else do not print
<5> awk '{if(NR%2){cur=$1;next}if($1==cur){printf "%s\n%s\n", cur, $1};cur=$1}'
<5> nope.



<5> That won't work.
<5> Hm, or will it.
<5> no
<5> awk '{if(NR==1){cur=$1;next}if($1==cur){printf "%s\n%s\n", cur, $1}cur=$1}'
<5> #appears to work
<5> Hm, this is going to need a pen and a pad to see if it's doing what i think it is.
<4> goldfish: yep, works, thanks
<4> yep, me too
<4> awk syntax is easier to read than sed's
<5> yes.
<5> I've never bothered to learn that stuff in sed, as i find awk nicer to read. *shrug*
<3> awk '{ for (line=1; i<=2; i++) { line = $1; getline; if ( line == $1 ) { print line}}}'
<4> yea, nice to know how to do it in sed tho
<3> gnubien, how many lines are there?
<5> variable amount.
<4> Zap-W: the ppl that asked that question in #sed said its an ip log with a million lines or so
<3> er replace line with i
<3> ip log ?
<4> Zap-W: ClientConnect: 0 (IP: 212.33.92.6:29070) \n ClientConnect: 1 (IP: 83.31.122.63:29070) \n etc
<4> Zap-W: ppl actually looking to match the IP addy like 212.33.92.6
<3> i see
<4> but the generic question got the correct answer
<4> thanks to goldfish and Zap-W
<5> Hm, thanks gnubien.
<5> You just helped me spot something :-)
<4> learn and share == collaboration
<4> goldfish: i got a talent for making ppl question fundamental beliefs ;/
<5> :/
<5> Man, I stayed up til 4am last night, playing online monopoly, how sad :/
<6> heh
<4> goldfish: tote a sack of e-money home with you?
<5> :-)
<5> I got beat.
<5> My friend wouldn't sell to me.
<5> So the other two dealt with each other, built hotels and 0wn3d us.
<4> goldfish: you play atlantik?
<4> it's not what you know but who you know many times
<4> goldfish: may have been a collusion between your "friend" and the 2 others; a setup ;/
<3> hey i just perfected the script , heh learning awk myself
<3> awk '{ lines=NR ; for (i=0; i<=lines ; i++) { line = $1; getline; if ( line == $1 ) { print line}}}' filename
<3> see if that works
<5> well it was 4 friends
<5> but yes.


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #awk
or
Go to some related logs:

#gaim
gentoo avermedia m115
get_build_platform
bogo filter suse
#perl
nzbperl howto
#ai
contract tablle
#gaim
#web



Home  |  disclaimer  |  contact  |  submit quotes