LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-23-2013, 09:05 AM   #1
rianariana
LQ Newbie
 
Registered: Nov 2013
Posts: 8

Rep: Reputation: Disabled
end to end delay calculation in satellite links awk file problem-ns2.35


How can e2edelay for satellite links be calculated for a trace file as below:

+ 1.0000 66 26 cbr 210 ------- 0 66.0 67.0 0 0 37.90 -122.30 48.90 -120.94
- 1.0000 66 26 cbr 210 ------- 0 66.0 67.0 0 0 37.90 -122.30 48.90 -120.94
r 1.0063 66 26 cbr 210 ------- 0 66.0 67.0 0 0 37.90 -122.30 48.90 -120.94
+ 1.0063 26 37 cbr 210 ------- 0 66.0 67.0 0 0 48.90 -120.94 32.60 -87.51
- 1.0063 26 37 cbr 210 ------- 0 66.0 67.0 0 0 48.90 -120.94 32.60 -87.51
r 1.0186 26 37 cbr 210 ------- 0 66.0 67.0 0 0 48.90 -120.94 32.60 -87.51
+ 1.0186 37 48 cbr 210 ------- 0 66.0 67.0 0 0 32.60 -87.51 48.90 -57.74
- 1.0186 37 48 cbr 210 ------- 0 66.0 67.0 0 0 32.60 -87.51 48.90 -57.74
r 1.0300 37 48 cbr 210 ------- 0 66.0 67.0 0 0 32.60 -87.51 48.90 -57.74
+ 1.0300 48 67 cbr 210 ------- 0 66.0 67.0 0 0 48.90 -57.74 42.30 -71.10
- 1.0300 48 67 cbr 210 ------- 0 66.0 67.0 0 0 48.90 -57.74 42.30 -71.10
r 1.0364 48 67 cbr 210 ------- 0 66.0 67.0 0 0 48.90 -57.74 42.30 -71.10
+ 61.0100 66 26 cbr 210 ------- 0 66.0 67.0 1 1 37.90 -122.30 45.33 -120.70
- 61.0100 66 26 cbr 210 ------- 0 66.0 67.0 1 1 37.90 -122.30 45.33 -120.70
r 61.0151 66 26 cbr 210 ------- 0 66.0 67.0 1 1 37.90 -122.30 45.33 -120.70
+ 61.0151 26 37 cbr 210 ------- 0 66.0 67.0 1 1 45.33 -120.70 29.02 -87.46
- 61.0151 26 37 cbr 210 ------- 0 66.0 67.0 1 1 45.33 -120.70 29.02 -87.46
r 61.0279 26 37 cbr 210 ------- 0 66.0 67.0 1 1 45.33 -120.70 29.02 -87.46
+ 61.0279 37 48 cbr 210 ------- 0 66.0 67.0 1 1 29.02 -87.46 45.33 -57.50
- 61.0279 37 48 cbr 210 ------- 0 66.0 67.0 1 1 29.02 -87.46 45.33 -57.50
r 61.0398 37 48 cbr 210 ------- 0 66.0 67.0 1 1 29.02 -87.46 45.33 -57.50
+ 61.0398 48 67 cbr 210 ------- 0 66.0 67.0 1 1 45.33 -57.50 42.30 -71.10
- 61.0398 48 67 cbr 210 ------- 0 66.0 67.0 1 1 45.33 -57.50 42.30 -71.10
r 61.0458 48 67 cbr 210 ------- 0 66.0 67.0 1 1 45.33 -57.50 42.30 -71.10
+ 121.0200 66 26 cbr 210 ------- 0 66.0 67.0 2 2 37.90 -122.30 41.76 -120.53
- 121.0200 66 26 cbr 210 ------- 0 66.0 67.0 2 2 37.90 -122.30 41.76 -120.53
r 121.0243 66 26 cbr 210 ------- 0 66.0 67.0 2 2 37.90 -122.30 41.76 -120.53
+ 121.0243 26 37 cbr 210 ------- 0 66.0 67.0 2 2 41.76 -120.53 25.45 -87.42
- 121.0243 26 37 cbr 210 ------- 0 66.0 67.0 2 2 41.76 -120.53 25.45 -87.42
r 121.0374 26 37 cbr 210 ------- 0 66.0 67.0 2 2 41.76 -120.53 25.45 -87.42
+ 121.0374 37 48 cbr 210 ------- 0 66.0 67.0 2 2 25.45 -87.42 41.76 -57.33
- 121.0374 37 48 cbr 210 ------- 0 66.0 67.0 2 2 25.45 -87.42 41.76 -57.33
r 121.0497 37 48 cbr 210 ------- 0 66.0 67.0 2 2 25.45 -87.42 41.76 -57.33
+ 121.0497 48 67 cbr 210 ------- 0 66.0 67.0 2 2 41.76 -57.33 42.30 -71.10
- 121.0497 48 67 cbr 210 ------- 0 66.0 67.0 2 2 41.76 -57.33 42.30 -71.10
r 121.0557 48 67 cbr 210 ------- 0 66.0 67.0 2 2 41.76 -57.33 42.30 -71.10
+ 181.0300 66 26 cbr 210 ------- 0 66.0 67.0 3 3 37.90 -122.30 38.19 -120.39
- 181.0300 66 26 cbr 210 ------- 0 66.0 67.0 3 3 37.90 -122.30 38.19 -120.39
r 181.0339 66 26 cbr 210 ------- 0 66.0 67.0 3 3 37.90 -122.30 38.19 -120.39
+ 181.0339 26 37 cbr 210 ------- 0 66.0 67.0 3 3 38.19 -120.39 21.87 -87.40
- 181.0339 26 37 cbr 210 ------- 0 66.0 67.0 3 3 38.19 -120.39 21.87 -87.40
r 181.0474 26 37 cbr 210 ------- 0 66.0 67.0 3 3 38.19 -120.39 21.87 -87.40
+ 181.0474 37 48 cbr 210 ------- 0 66.0 67.0 3 3 21.87 -87.40 38.19 -57.19
- 181.0474 37 48 cbr 210 ------- 0 66.0 67.0 3 3 21.87 -87.40 38.19 -57.19
r 181.0600 37 48 cbr 210 ------- 0 66.0 67.0 3 3 21.87 -87.40 38.19 -57.19

My awk file looks like this:

BEGIN {
src="66.0"; dst="67.0";
num_samples = 0;
total_delay = 0;
}
/^\+/&&$8==src&&$9==dst {
t_arr[$10] = $2;
};
/^r/&&$8==src&&$9==dst{
if (t_arr[$10] > 0) {
num_samples++;
delay = $2 - t_arr[$10];
total_delay += delay;
};
};
END{
print "Delay is" total_delay*1000 "ms";
};

It produces 0 ms delay.
 
Old 11-23-2013, 09:28 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394
These seem to be wrong: /^\+/&&$8==src&&$9==dst { (same is true for /^r/&&$8==src&&$9==dst{).

If I look at the input provided than you need to be looking for $9 and $10:
Code:
/^\+/ && $9==src && $10==dst {
# and
/^r/ && $9==src && $10==dst {
 
2 members found this post helpful.
Old 11-23-2013, 10:35 AM   #3
rianariana
LQ Newbie
 
Registered: Nov 2013
Posts: 8

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by druuna View Post
These seem to be wrong: /^\+/&&$8==src&&$9==dst { (same is true for /^r/&&$8==src&&$9==dst{).

If I look at the input provided than you need to be looking for $9 and $10:
Code:
/^\+/ && $9==src && $10==dst {
# and
/^r/ && $9==src && $10==dst {
Thank you so much ....all these time I was assuming the blank in the middle is not a column at all...

Regards
Riana
 
Old 11-23-2013, 10:46 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394
You're welcome

BTW: Can you put up the [SOLVED] tag.
- above the first post -> Please Mark this thread as solved if you feel a solution has been provided.
- -or- -
- first post -> Thread Tools -> Mark this thread as solved
 
  


Reply

Tags
awk-ns2


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Errors while using awk script for calculating average end to end delay in ns2 NS2User2012 Linux - Networking 4 02-17-2013 12:20 PM
awk error awk: line 2: missing } near end of file boscop Linux - Networking 2 04-08-2012 11:49 AM
[SOLVED] Add lines end of file above the end comments bkone Programming 2 02-27-2012 10:58 AM
Running a Crafted bash script yelds 'Unexpected end of file' at the end of the file MCLover1337 Linux - General 5 10-15-2011 09:29 AM
[SOLVED] bash awk column to end of file alex1986 Programming 8 09-04-2010 07:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration