[SOLVED] Delete rows based on values in a column using sed
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.
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 have a lot of files with thousands of rows and usually two columns of data. Column 1 is a coordinate, column 2 is a score. I want to delete rows that have a value in column 2 over, in this case, 50.
I have a lot of files with thousands of rows and usually two columns of data. Column 1 is a coordinate, column 2 is a score. I want to delete rows that have a value in column 2 over, in this case, 50.
test the result, then add option -i if you want to edit the file in place. This assumes that there are not spaces before the first field, otherwise you have to add more items in the regular expression to strictly match the second field.
Thank you all! I used the awk command first and it worked like a charm. I knew awk would work but I know nothing on its usage. I can understand exactly what it's doing in this command though. I'll be able to adapt this to new uses for sure.
On a related question is there any guide to awk and/or sed that is really, really basic? I mean like a "For Dummies" book of "AWK For Dummies." I need to get a LOT better with awk and sed.
Thank you all! I used the awk command first and it worked like a charm. I knew awk would work but I know nothing on its usage. I can understand exactly what it's doing in this command though. I'll be able to adapt this to new uses for sure.
On a related question is there any guide to awk and/or sed that is really, really basic? I mean like a "For Dummies" book of "AWK For Dummies." I need to get a LOT better with awk and sed.
Thanks again
I think EVERYONE could always learn more about awk and sed.
There are lots of tutorials and books, but the amount of information on those two commands is massive. Good luck.
PS: pwc101, yes I know you don't have to use cat, but good catch for claritys sake, thanks.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.