LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   an awk script to calculate energy consumption (https://www.linuxquestions.org/questions/linux-networking-3/an-awk-script-to-calculate-energy-consumption-4175511371/)

Faiza Al-Salti 07-17-2014 03:27 AM

an awk script to calculate energy consumption
 
Hi,

Can anyone help me in writing an awk script to calculate total energy consumption from a trace file with new-trace format produced by NS2?

rtmistler 07-17-2014 12:20 PM

Not many will help in the form of just writing a script to suit your needs. For starters you ought to determine how to calculate what you wish from the available data, in parallel determining if you have sufficient data to accomplish this. The next step would be to attempt a script, either with awk, bash, python, or some other script language. I just said in another thread that I'm not highly experienced with awk, but ... I don't believe it is a script language. Bash is, as is python, tcl, and perl. Awk is a pattern scan and processor; which will do actions; however you'd use something like a bash script to invoke awk in the way you wish. For instance, say you have record files and need to extract specific parts of records to use as the numbers for your calculations, then you'd use awk to help you there; and as said earlier, you'd use a scripting language to perform the rest of the operations.

Here are some references on bash:

Bash Guide for Beginners

Advanced Bash Scripting Guide

Blog Entry on Bash Scripting


All times are GMT -5. The time now is 09:26 AM.