I have a huge tab-delimited text file with 10 columns. Now I want to delete all rows from the file that contain no value in column 10.
For example:
a b c d e f g h i j
4 6 8 9 4 2 1 6 4 2
1 5 9 8 5 1 8 3 6
1 6 8 5 4 7 7 9 4 7
4 5 8 9 9 2 1 8 4
3 4 7 5 8 8 2 5 3 6
Expected output:
a b c d e f g h i j
4 6 8 9 4 2 1 6 4 2
1 6 8 5 4 7 7 9 4 7
3 4 7 5 8 8 2 5 3 6
I would like to use something like:
awk '$10 == ""' print $0 file
>Solution :
Your command was almost there. You can try this:
awk '$10 != "" {print}' file
$10 != ""This tests if the 10th field is not emptyprintprints the entire line