LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-18-2014, 11:00 AM   #1
chenil
LQ Newbie
 
Registered: Apr 2013
Posts: 21

Rep: Reputation: Disabled
how to understand awk


I want to understand attached energy_wireless.awk.

Please guide me.
Attached Files
File Type: txt energy_wireless.awk.txt (1.4 KB, 28 views)
 
Old 04-18-2014, 11:55 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,492

Rep: Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867
Exactly what guidance are you looking for?

Are you saying you have looked through the manual and none of what is contained in the script makes sense?
 
Old 04-18-2014, 02:55 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016 CentOS6.9 CentOS7.3 + 50+ other Linux OS, for test only.
Posts: 16,625

Rep: Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266
"energy_wireless.awk" is an "awk script for ns2 trace files".

Using, example : $ ns wireless-flooding.tcl
.. will create the trace file "wireless-flooding-DumbAgent.tr"
Code:
$ awk -f energy_wireless.awk wireless-flooding-DumbAgent.tr                                        
No of pkts send                 43
No of pkts recv                 65
Pkt_delivery_ratio:             151.163
Control_overhead:               0
Normalized_routing_overheads:   0
Delay:                          0.00385983
Throughput:                     224612
Jitter:                         0.0082657
No of Pkts Dropped              -22
Dropping_Ratio:                 -51.1628
Total_Energy_Consumption:       0
Avg_Energy_Consumption:         0
Overall Residual Energy:        -23
Avg Residual Energy:            -1
 
Old 04-19-2014, 12:25 PM   #4
chenil
LQ Newbie
 
Registered: Apr 2013
Posts: 21

Original Poster
Rep: Reputation: Disabled
understanding awk

Quote:
Originally Posted by grail View Post
Exactly what guidance are you looking for?

Are you saying you have looked through the manual and none of what is contained in the script makes sense?
Yes i am unable to understand the content..how to write awk?

can you send me any ".awk" script along with a ".tr" and explanation about how to write it?
I am fully confused..
 
Old 04-19-2014, 01:20 PM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016 CentOS6.9 CentOS7.3 + 50+ other Linux OS, for test only.
Posts: 16,625

Rep: Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266
# 4 . How to write awk ...

https://www.google.com/webhp?hl=all#...w+to+write+awk
 
1 members found this post helpful.
Old 04-19-2014, 01:22 PM   #6
chenil
LQ Newbie
 
Registered: Apr 2013
Posts: 21

Original Poster
Rep: Reputation: Disabled
need of .sh file

Quote:
Originally Posted by knudfl View Post
What is need of ".sh" file in implementation?
 
Old 04-19-2014, 02:17 PM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016 CentOS6.9 CentOS7.3 + 50+ other Linux OS, for test only.
Posts: 16,625

Rep: Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266
# 6 .
Quote:
What is need of ".sh" file ...
Do you mean a shell script / bash script ? And which one ?
 
Old 04-20-2014, 08:43 AM   #8
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,492

Rep: Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867
Well I see nothing from the original script that is very hard to understand assuming you have read the manual.

In case you had trouble using google or any other search engine to find one:

http://www.gnu.org/software/gawk/man...ode/index.html

After reading the manual, please advise which part you are confused about?
Quote:
can you send me any ".awk" script along with a ".tr" and explanation about how to write it?
Not sure what a ".tr" is, but as you are asking the question it would be up to you to provide what it is you do not understand and to actually ask a clear question.
 
1 members found this post helpful.
  


Reply


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
turning awk command line entries into awk scripts tabbyagirl Linux - Newbie 5 08-22-2013 12:46 AM
Awk doesn't understand 'read' statement!!! ravisingh1 Programming 2 04-20-2013 01:07 PM
[SOLVED] Trying to understand how awk uses two input files bop-a-nator Linux - Newbie 9 01-10-2013 01:52 AM
[SOLVED]Wierd AWK behavior / AWK not reading first line. Involar Linux - Newbie 9 11-28-2012 10:53 AM
[SOLVED] call awk from bash script behaves differently to awk from CLI = missing newlines titanium_geek Programming 4 05-26-2011 09:06 PM


All times are GMT -5. The time now is 06:53 PM.

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