Hi this is an sh file to plot values in an xgraph.
Code:
for j in dcma 802_11
{
rm -rf result_$j
rm -rf PDR_$j DELAY_$j THROUGHPUT_$j LOSS_RATIO_$j AVG_ENERGY_$j RESIDUAL_ENERGY_$j
for i in 0.09 0.089 0.088 0.085 0.084
{
ns dcma.tcl $i $j &> output
gawk -f analysis.awk out.tr >> result_$j
}
}
for j in dcma 802_11
{
echo "$j"
gawk 'BEGIN{x=1;}{ print x " " $1; x+=1 }' result_$j >> PDR_$j
echo " "
gawk 'BEGIN{x=1;}{ print x " " $2; x+=1 }' result_$j >> DELAY_$j
echo " "
gawk 'BEGIN{x=1;}{ print x " " $3; x+=1 }' result_$j >> THROUGHPUT_$j
echo " "
gawk 'BEGIN{x=1;}{ print x " " $4; x+=1 }' result_$j >> LOSS_RATIO_$j
echo " "
gawk 'BEGIN{x=1;}{ print x " " $5; x+=1 }' result_$j >> AVG_ENERGY_$j
echo " "
gawk 'BEGIN{x=1;}{ print x " " $6; x+=1 }' result_$j >> RESIDUAL_ENERGY_$j
echo " "
}
for i in PDR_ DELAY_ THROUGHPUT_ LOSS_RATIO_ AVG_ENERGY_ RESIDUAL_ENERGY_
{
xgraph $i'dcma' $i'802_11' -lw 2 -x "$i" -y "Rate (Mbps)" -t "$i"
}
When I try executing this file. I'm getting the following errors.
[root@localhost script1]# sh script.sh
'cript.sh: line 2: syntax error near unexpected token `{
'cript.sh: line 2: `{
Can someone please help me.
Thanks in advance.