LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] [Possibly OT] Network Traffic Analysis and InterfaceControl

[ILUG] [Possibly OT] Network Traffic Analysis and InterfaceControl

Brian Foster blf at blf.utvinternet.ie
Thu Feb 23 18:58:53 GMT 2006


  | Date: Thu, 23 Feb 2006 13:59:08 -0000
  | From: "Hamilton, David (TSG C&I)" <david.hamilton3 at hp.com>
  | Errors-To: ilug-bounces at linux.ie
  |[ ... ]
  |    tethereal ... | tail -6 | head -5 | awk ... | (tr ',\n' + && echo 0) | bc

 well, if yer using awk(1), you don't need to use head(1),
 tail(1), or Pádraig's trick for using bc(1) with yer output;
 `awk' is perfectly capable of selecting lines and fields
 within lines, adding them together, and printing the sum.

  | -----Original Message-----
  | Sent: 23 February 2006 13:36
  | From: Pádraig Brady
  | 
  |[ ... ] if you want to add the numbers from the shell:
  | 
  |    tethereal ... | (tr '\n,' + && echo 0) | bc

 the numbers, provided they are integers (decimal?),
 can also be added by the GNU bash(1) shell itself,
 by `eval'ing a slightly tricky variable subsistion:

x=$( echo '1,2,3
4,5,6' )    # $x contains simluated  tetherreal ...
            #  replace echo ... with tetherreal ...

eval $'y=$(( ${x//[,\n]/+} ))'  # add, result in $y

echo $y     # print the sum ($y)

 of course, tweaking the  tetherreal ...  output
 so it's easier to process is a rather good idea.

 shell scripts are easy.  ;-)

cheers!
	-blf-
-- 
Experienced (20+ yrs) kernel/software Eng: | Brian Foster   Montpellier,
 • Unix, embedded, &tc;  • Linux;  • doc;  | blf at utvinternet.ie   FRANCE
 • IDL, automated testing, process, &tc.   |  Stop E$$o (ExxonMobile)!
Résumé (CV) http://www.blf.utvinternet.ie  |     http://www.stopesso.com



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell