Hi Martina!

Yes the problem in my awk script! I think I need to re-write it in different 
way, since the whole script will be executed for each line of the simulation 
trace results, and its different when the whole trace file is there and we 
just filter it. However I did try a simple awk just to type one or two lines 
and did work.

The problem now in counting, for example: 
To count how many sent pkts we have I did use:

BEGIN {S=0}
$1~/s/ && $2~/-t/ {S ++}
END {print "Total Sent pkts are = " S }

and it's keep giving me 0, however the results is not zero, but I think it 
keep re-set the S, since the awk executed (in total) every time we have a new 
line of results!

Do you think so? what's your opinion?

However, Thank u so much for help
Tariq


>===== Original Message From Martina Umlauft <[EMAIL PROTECTED]> =====
>Hi there,
>
>Tariq Alsaifi schrieb:
>> Hello every one!
>>
>> I did check the archive before I wrote this, and the only related I found 
was
>> this:
>>
>> http://mailman.isi.edu/pipermail/ns-users/2006-May/055626.html
>[...]
>> The previous suggestion was:
>>
>> set tr [open "| awk -f filter.awk >out.tr" w]
>> $ns trace-all $tr
>[...]
>>
>> However I did try it and didn’t work, so let me ask the question again:
>
>How did it fail? I use this a *lot* an it definitely works. So, what
>exactly did you do and what exactly went wrong?
>
>Did you check the following:
>
>-) is awk in your path? If not, either make sure awk is in your path or
>give the absolute name (= path+name) to the awk command
>
>-) is your awk script in the same directory from where you call the .tcl
>script? If not, use the complete pathname + awk file name
>
>-) maybe you made a typo and called the wrong filename?
>
>-) is the awk script itself correct? If the awk script gets called but
>the result is not correct (or it crashes) maybe there is something wrong
>with the awk script? Did you test the awk script manually on a full
>trace file?
>
>-) does the .tcl file work without the awk command? Iow., if you run it
>without calling awk do you really get the tracefile in the format you
>expect?
>
>filter.awk should contain your awk script and out.tr will contain the
>results of the awk script.
>
>> What is the correct code to include awk (file or code) within ns TCL script 
so
>> the awk file can be executed without having trace file, so no consuming 
disk
>> space (no big trace files, just the results we want to see using awk) AND 
at
>> the same time it gives the same results as if we have the whole trace file 
and
>> we filter it by the awk file
>
>If you tried the second method mentioned in the old posting
>
>>> set tr [open "| awk '{print $2 \" \" $4}' >out.tr" w]
>
>are you sure that you used \ to escape all " that might occur? This
>means that since you cannot write a " inside a string you have to write
>a \ in front of every ".
>
>eg. in the above example, if you were to write the awk command on the
>command line prompt, you would write
>
>awk '{print $2 " " $4}' > out.tr
>
>But inside the string you have to write it as shown above.
>
>
>And finally, you are using this on a Linux system, where awk is actually
>installed and working, right? I have no experience with cygwin
>installations and I have no idea if they provide you with awk or whether
>their version of awk might behave differently.
>
>
>greetings, Martina


Reply via email to