Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How do you create an awk script file, myawkmax, that will read 6 numbers, determine which number is the largest one, and then display the largest number.
- the awk script of myawkmax, must include a self-defined function with 6 parameters. No awk built-in functions are allowed to be used in your script.
When test the script with at least following testing cases:
$ ./myawkmax 3 1 2 5 4 6 7
The largest number is 7
$ ./myawkmax -3 -1 -2 -4 -5 -6
The largest number is -1
szboardstretcher may be correct with their thoughts about a possible homework question. To add to that, my same comments from your other awk question in the Programming forum: LQ members are not here to provide on demand code answers for you. Instead the forum prefers that you attempt to solve your problem and post what you've tried. If you have no idea how to write awk scripts, then ask for help at starting and then post some of your initial attempts.
Hi fanoflq, your first answer offering a helpful link for awk is perfect. Along the lines of the rules cited by szboardstretcher, please note that one of those cites to not post if you do not have something useful to say. So let's stay on topic and see if souchai can provide some additional feedback regarding their needs to accomplish their project.
awk is intended for processing input read from standard input or from files whose names are given on the command line.
So with ./myawkmax 3 1 2 5 4 6 7 either you have misunderstood the question or if that is how the question was worded you have been set a real nasty one.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.