Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2005-04-06
3
Medium Priority
?
210 Views
Last Modified: 2013-12-27
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!
0
Comment
Question by:pdadddino
  • 2
3 Comments
 

Author Comment

by:pdadddino
ID: 13720729
figured it out
awk '{if ($2 != "") print $0};' input file name  >  output file name
0
 
LVL 21

Accepted Solution

by:
tfewster earned 2000 total points
ID: 13721664
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
0
 

Author Comment

by:pdadddino
ID: 13721682
did not want to delete just for others possible edification!
Thanks for the additional solutions!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month12 days, 14 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question