have file with 2 columns. trying to remove row when 2nd column is blank

have file that has many rows. 2 columns in each row, tab delimited. some rows have nothing in seconds column. i want to get rid of these rows!
Who is Participating?
If noone else has posted in your question, you should have an option to delete it yourself; But now you'll have to post in http://www.experts-exchange.com/Community_Support/ to ask them to delete it (Sorry!)

By the way, if there were more than 2 columns in your file, you'd need to specify the field seperator - Otherwise awk just assumes any whitespace is a single field seperator

awk -F "^I" '$2!="" {print $0}' input file name  >  output file name
(where ^I is a <Tab> character, which can be inserted with Ctrl-V then Ctrl-I

Alternatively, in this example, you could just go on the number of fields:
awk 'NF==2 {print $0}' input file name  >  output file name
pdadddinoAuthor Commented:
figured it out
awk '{if ($2 != "") print $0};' input file name  >  output file name
pdadddinoAuthor Commented:
did not want to delete just for others possible edification!
Thanks for the additional solutions!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.