- I save this file as a (.awk) - this code it only execute if I used this comman
ID: 3828597 • Letter: #
Question
- I save this file as a (.awk) - this code it only execute if I used this command ( ./ filename.)
The question or the issue I need help with is I'm trying to run or execute this code on the terminal Using this command ( awk -f filename) because that's how the professor he's going to test it
What do I have to do or change or add???????
in this script, i am going to write awk program using the file named (example satary data file) an i'm going to write an awk program that comprises BEGIN, main(pattern/action), and END segments awk 'BEGIN (print "Ahmed Abdo Users Info OFS Average 0; Users 0) if ($2 $3 500) print $1,$2 $3; Average Average+$2*$3; Users Users+1) END{print "Total Number of Users (Earners of $500 or more) Users; print "Total Salary Average example salary data file
Explanation / Answer
You need to add
on top of the script so that the editors like Vim will recognize the file as an AWK script and run accordingly.
Hope this helps you. Let me know if you have any doubt.
Please give the thumbs up, if it is helpful for you. Thank you!!
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.