ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
There is less than 2 hours left to vote in the 2015 LinuxQuestions.org Members Choice Awards. Click here to go to the polls. Vote now and make sure your voice is heard!
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.
Thanks it works.Ill check it out if i can use this in my programme. I am trying to read a file which say has contents of ls -l in it,and extract the file names from it and add it to a database,so if a file name has spaces in it my script is failing.Ill try it out with cut.
EDIT: -f1,3 prints 1 and 3
-f1-3 prints 1 to 3
-f1- prints 1 to infinte got it thanks.
It would be nice to know how to do the same using awk and print a range of columns.
Like pixellany, I do assume a basic understanding of awk.
The command given:
- sets the output field and record separator (OFS and ORS) to NULL, which makes sure that all is printed on the same line.
- prints fields number 6 up to the last field (NF holds the last field) on one line,
- the print $NF "\n" prints the last field and a carriage return (thus making sure all entries are on their own line).