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.
I apologize if this is the wrong place but I am new here. I have only been working with linux for a few months so I am pretty new. Currently I am having trouble with a script that I am writing. I have always had trouble with formatting sort commands and this one has me stumped.
For security purposes I have typed out an "example" file that is in no way related to the original file. This is my example (in no way related so pardon the ridiculousness of the content) :
in this script, I need to use the awk command to filter ONLY entries that contain "steak" as a menu item. (this I have working properly). Here is what I DON'T have working properly.
1. I need to restructure the columns so that when I run the script, they print in the order menu# (NOT in numerical order), item, side and then price
2. My steak list needs to be ordered by PRICE in ascending order and NOT by menu number.
I apologize if this is the wrong place or if this is really vague. I was instructed to use the sort command specifically.
I was instructed to use the sort command specifically.
The utility sort is definitely what you could use, with or without other pieces. Look around the Web for examples of using it with the -k option. Please also take a look at the manual page as well but just, in this case, for an example of a poor manual page. However, it will become useful as you get familiar with sort
this is my draft so far. I have not run it yet because I know it is a hot mess and probably not structured properly. I found a board that showed to use the 'awk' command to change the order of the columns.
*names have been changed to reflect my example file*
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.