LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-26-2015, 03:34 AM   #1
Rizwanamalek
Member
 
Registered: Jan 2015
Posts: 56

Rep: Reputation: Disabled
Error in awk file execution


Sir when i execute this gawk command it gives me same error for any files.Why this happen?

Code:
[root@localhost ns-allinone-2.34]# gawk –f throughput1.awk out1.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]#
 
Old 03-26-2015, 04:29 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,899

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
how did you edit that awk file?
 
Old 03-26-2015, 04:49 AM   #3
Rizwanamalek
Member
 
Registered: Jan 2015
Posts: 56

Original Poster
Rep: Reputation: Disabled
I have used this thruput.awk file and out1.tr is sample file created by la.tcl file .I copy and past trrougput.awk in same folder with la.tcl (give out1.tr file). And the execute the command gawk f throughput1.awk out1.tr. It is wrong method to take awk result of this two files?
Code:
#####################################################################
################http://www.ns2blogger.blogspot.in/###################
#####################################################################

BEGIN {
       recvdSize = 0
       startTime = 1e6
       stopTime = 0
  }
   
  {
       
       # Trace line format: new
       if ($2 == "-t") {
             event = $1
             time = $3
             node_id = $5
             flow_id = $39
             pkt_id = $41
             pkt_size = $37
             flow_t = $45
             level = $19
       }
   
  # Store start time
  if (level == "AGT" && (event == "+" || event == "s") && pkt_size >= 512) {
    if (time < startTime) {
             startTime = time
             }
       }
   
  # Update total received packets' size and store packets arrival time
  if (level == "AGT" && event == "r" && pkt_size >= 512) {
       if (time > stopTime) {
             stopTime = time
             }
       # Rip off the header
       hdr_size = pkt_size  512
       pkt_size -= hdr_size
       # Store received packet's size
       recvdSize += pkt_size
       }
  }
   
  END {
       printf("Average Throughput[kbps] = %.2f\t\t StartTime=%.2f\tStopTime=%.2f\n",(recvdSize/(stopTime-startTime))*(8/1000),startTime,stopTime)
  }
 
Old 03-26-2015, 04:56 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,899

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
Sorry, it looks like the file was somehow damaged during download or copy/paste or ???. Did you try to modify it by yourself?
 
Old 03-26-2015, 04:56 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
"gawk -f"

The hyphen that you are using is wrong . Must be ' - '.




-

Last edited by knudfl; 03-26-2015 at 04:58 AM.
 
1 members found this post helpful.
Old 03-26-2015, 05:05 AM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Besides that, no need to copy / paste a file.

"All" the throughput scripts are included in 'awk-and-perl_scripts_12.2014.tar.gz'
https://drive.google.com/file/d/0B7S...ew?usp=sharing

avg_throughput.awk
avg_throughput-zigbee.awk
avg_thr_wirelss.awk
chainThroughput.pl
e2ethroughput.awk
flow-thr.awk
genthroughput.awk
instantThroughput.awk
instantThroughputStll.awk
Lianghui-throughput.pl
myflowcalcall_throu.awk
thr_drop_delay.awk
thr-one.pl
Throughput2007.awk
throughput-8.pl
throughput-9.pl
throughput_newtrace.awk
throughput.pl
thruput.awk
updown-link-thr.pl
wireless-thr.awk
 
Old 03-26-2015, 05:08 AM   #7
Rizwanamalek
Member
 
Registered: Jan 2015
Posts: 56

Original Poster
Rep: Reputation: Disabled
post#4 If i am using any other file it gives me same error.
post#5 you mean to say that i have to use "- f" instead "-f" ?
 
Old 03-26-2015, 05:12 AM   #8
Rizwanamalek
Member
 
Registered: Jan 2015
Posts: 56

Original Poster
Rep: Reputation: Disabled
#post 6 i found folder "awk-and-perl_scripts_11.19.2014" For what pourpose i have to use it?
Sir i simply want to calulate my xyz.tcl file`s throughput. For that i found that i have to use this command "gawk f throughput1.awk out1.tr" .
 
Old 03-26-2015, 06:29 AM   #9
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Quote:
"awk-and-perl_scripts_11.19.2014" For what pourpose
* Try out the ~20 "throughput scripts" to know if any of those will work with your unknown file.

Usually you cannot just choose a random script from the Internet.
May not work with your trace file.
Hence the choice of ~20 scripts : You may have luck with one or two scripts.
( Besides that, not all trace files may be fit for analyzing.)

-
 
Old 03-26-2015, 10:03 AM   #10
Rizwanamalek
Member
 
Registered: Jan 2015
Posts: 56

Original Poster
Rep: Reputation: Disabled
sir i have tried all awk files but it gives me the same result
Code:
[root@localhost ns-allinone-2.34]# gawk –f all.awk out1.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f all.awk wireless.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f all.awk my.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f all.awk kmeans.tr 
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Del.awk kmeans.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Del.awk my.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Del.awk wireless..tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Del.awk wireless.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Del.awk out1..tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Del_Flow.awk out1..tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Del_Flow.awk out1.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Del_Flow.awk wireless.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Del_Flow.awk my.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Del_Flow.awk kmeans.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Del_Flow.awk kmeans.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Del_Flow.awk my.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Del_Flow.awk wireless.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Del_Flow.awk out1.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Del_Flow.awk out1.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Del_Flow.awk wireless.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Del_Flow.awk my.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Del_Flow.awk kmeans.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Jit.awk kmeans.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Jit.awk my.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Jit.awk wireless..tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Jit.awk wireless.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Jit.awk out1.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Jit_Flow.awk out1.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Jit_Flow.awk wireless..tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Jit_Flow.awk wireless.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Jit_Flow.awk my.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Jit_Flow.awk out1.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avgStats.awk out1.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avgStats.awk my.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avgStats.awk wireless.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avgStats.awk kmeans.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_throughput.awk kmeans.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_throughput.awk wireless..tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_throughput.awk wireless.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_throughput.awk my.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_throughput.awk out1..tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_throughput.awk out1..tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_throughput.awk out1.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_throughput.awk my.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_throughput.awk wireless..tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_throughput.awk wireless.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_throughput.awk kmeans..tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_throughput.awk kmeans.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_thr_wirelss.awk kmeans.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_thr_wirelss.awk wireless.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_thr_wirelss.awk my.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_thr_wirelss.awk out1.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_thr_wirelss.awk out1.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_thr_wirelss.awk my.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_thr_wirelss.awk wireless.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_thr_wirelss.awk kmeans.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Tput_Flow.awk kmeans.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Tput_Flow.awk wireless.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Tput_Flow.awk my.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Tput_Flow.awk out1.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Tput_Flow.awk out1.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Tput_Flow.awk my.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Tput_Flow.awk out1.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Tput_Flow.awk my.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Tput_Flow.awk wireless.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f Avg_Tput_Flow.awk kmeans.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_thr_wirelss.awk kmeans.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f avg_thr_wirelss.awk wireless.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f wireless-thr.awk wireless.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f wireless-thr.awk kmeans..tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f wireless-thr.awk kmeans.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f wireless-thr.awk my.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f wireless-thr.awk o.tr
otcl/                     otcl_ns234_gcc-4.4.patch  out1.tr
otcl-1.13/                out1.nam                  
[root@localhost ns-allinone-2.34]# gawk –f wireless-thr.awk out1.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f updown-link-thr.awk out1.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f updown-link-thr.awk my.tr
gawk: –f
gawk: ^ invalid char '�' in expression
[root@localhost ns-allinone-2.34]# gawk –f updown-link-thr.awk kmeans.tr
gawk: –f
gawk: ^ invalid char '�' in expression
How can i get result using awk file? How can i get energy,throughput etc. value of my .tcl file
 
Old 03-26-2015, 10:09 AM   #11
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
You will get ""gawk: ^ invalid char '' in expression""
... until you stop with using forbidden characters in your command.

The hyphen ( - ) that looks like two hyphens (--) is not a valid character.
 
Old 03-26-2015, 10:52 AM   #12
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,780

Rep: Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213
It shows up here as a 3-em dash, not a minus sign. It's not apparent how you are getting that into a command line, perhaps by cutting and pasting the output from some word processor.
 
Old 03-26-2015, 11:03 AM   #13
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
seems like ms-windows copy-pasta:
Code:
gawk f != gawk -f


edit: i am not even sure how you are pasting a dash (instead of a hyphen) into the post. it wont allow me to in this example.

Last edited by schneidz; 03-26-2015 at 11:08 AM.
 
1 members found this post helpful.
Old 03-26-2015, 12:10 PM   #14
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
@schneidz : Yes, that's odd.
Some members can type or copy/paste any forbidden character.
My attempts typing or copy/paste from e.g. post #1 are not shown too.
 
Old 03-26-2015, 01:09 PM   #15
Rizwanamalek
Member
 
Registered: Jan 2015
Posts: 56

Original Poster
Rep: Reputation: Disabled
sir.i got results. If it is valid or not?
Code:
[root@localhost ns-allinone-2.34]# gawk -f throughput_newtrace.awk out1.tr
Average Throughput[kbps] = -0.00		 StartTime=400.00	StopTime=0.00
[root@localhost ns-allinone-2.34]# gawk -f Throughput2007.awk out1.tr
Average Throughput[kbps] = -0.00		 StartTime=1000000.00	StopTime=0.00
Average Throughput[kbps] = -0.00		 StartTime=1000000.00	StopTime=0.00
[root@localhost ns-allinone-2.34]# gawk -f genthroughput.awk out1.tr
Average Throughput[kbps] = -0.00		 StartTime=400.00	StopTime=0.00
Is there any link from where i get parameaters awk file, network life time, energy, througput,scalabiltty,efficiency,Energy Consumption, power consumption and overall network performance,Power Usage of my .tcl file?
 
  


Reply

Tags
awk-ns2, ns2



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
awk error awk: line 2: missing } near end of file boscop Linux - Networking 2 04-08-2012 10:49 AM
Execution of awk script gives error message for invalid character tanggo81 Linux - Kernel 2 06-26-2010 02:35 AM
targa.c file execution error soni_silver17 Linux - Software 2 04-30-2009 12:41 PM
targa.c file execution error soni_silver17 Linux - Software 3 04-01-2009 09:29 AM
.Jar file execution error on FC7 immortaltechnique Linux - Software 6 12-21-2007 04:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:44 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
Open Source Consulting | Domain Registration