Did you guys know how to use ‘awk’ in TCL script? If you don’t know, No worries!!! This article will helps you as a proper guide to use ‘awk’ in the TCL script. Let’s start this!!!
Awk Script
To calculate the number of data transferred, then execute the following awk code,
event = $1;
time = $2;
printtime =$2;
if (event == “+” || event == “-“) node_id = $3;
if (event == “r” || event == “d”) node_id = $4;
flow_id = $8;
pkt_id = $6;
Awk in TCL script in UNIX
The following TCL script code is used to calculate the performance metrics based on the awk based auto genertated trace file,
exec awk -f Energy.awk OUT.tr > AODV_100Nodes_Energy.tr
exec awk -f Throughput.awk OUT.tr > AODV_100Nodes_Throughput.tr
The following TCL code is used to execute the Xgraph based auto generated trace file,
exec xgraph AODV_100Nodes_Energy.tr -t “Energy Graph” -x “No.of.Nodes” -y “Energy” -bg pink &
exec xgraph AODV_100Nodes_Throughput.tr -t “Throughput Graph” -x “No.of.Nodes” -y “Throughput” -bg pink &
If you have queries based on the purpose to use ‘awk’ in TCL script, please reach us.