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!
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I currently have a script that checks whether some cameras have been recording continuously since a given date. If it finds times where the recording stopped it echos the path and how much time was stored there. This all works fine so I don't need any help there.
Now I want to create a script that takes everything printed by the last script and organizes it into a nice table. Would awk be the best thing to use for this?
I can still manipulate what the output of the other script is so I figure I should be able to put some sort of separator in (";" maybe). The table will have to show a few different types of errors (not enough time, camera reset, etc.) along with the path so I might need different types of separators for different things? This is my first time writing a script of this nature so I'm just throwing some ideas out there.
If anyone could give me some insight as to how to get started that would make this much easier. I don't want to sink a few hours into this just to find out I could have used a much easier method.
awk is a good tool for a single table of data. You can set the field separator and it will automatically split the fields for you so you can modify and print the output formatted the way you want. You can also print the table header in the BEGIN block and a summary in the END block (for example).
If you need multiple levels of fields I would use Perl which has a general split command that can split a string on any pattern. If you don't want to spend the time learning Perl you could still do this with multiple calls to awk. But it might be a little more "awkward".