Results 1 to 4 of 4
Thread: Acumulative counter with grep
|
Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
-
05-09-2008 #1
- Join Date
- May 2008
- Posts
- 7
Acumulative counter with grep
I need counter in a single file for all connections to port 1352. How I can make an acumulative counter?
netstat -n |grep 1352 -c >users_notes.txt this sentence only save one value, and when I execute again the value is overwritte with the new value
Thanks a lot
-
05-09-2008 #2
hi,
if you just want to write the value to the new file without deleting the existing values
you use append as follows
Code:netstat -n |grep 1352 -c >>users_notes.txt
but im afraid your command does not count exactly the number of connections. maybe the next one would be a bit more precise.
Code:netstat -n |grep 1352 | grep -i connected -c >>users_notes.txt
Linux and me it's a love story
-
05-09-2008 #3
- Join Date
- May 2008
- Posts
- 7
Thanks a lot Khafa
-
05-09-2008 #4
you very welcome
Linux and me it's a love story