Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I'd like to grep the entire line where last column has NOT a specific value in bash

I’m looking for a way that allows me to show the entire lines of a file or output where the last column is not "A".

I am aware that I can use awk ‘{print $(NF)}’ and then use a negative grep to exclude the rows that have A in the last column, but that would only show me the last column value while I need the entire lines.

Any suggestions?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Just check the last column in awk:

awk '$NF != "A"
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading