Search code examples
linuxcommandextractblank-line

How to extract lines containing blank in a specific column with Linux command


Example:

aa\tab\tac\tad\tae
ba\tbb\tbc
ca\tcb\tcc
da\tdb\tdc\tdd

Expected output:

ba\tbb\tbc
ca\tcb\tcc

I want to extract lines containing blank in a 4th column with linux command. If you know the command, could you let me know it?


Solution

  • Using awk

    $ awk -F"\\" '{if($4=="") print}' input_file
    ba\tbb\tbc
    ca\tcb\tcc