delete lines with empty second column


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting delete lines with empty second column
# 1  
Old 03-12-2011
Java delete lines with empty second column

hi,
I'd like to ask you if you can help me with such surely easy thing - I have some data and need to plot them. I have txt of data in two columns, tab separated, but some second columns are empty. like
Code:
1````       2
1.2`` 
3````       2
4.44` 
5`````
6.1```1

how can I erase all the lines with the second empty column? (2nd, 4th, 5th) The lenght of numbers in the first column varies.
the second column is initiated by tab despite its emptyness.
thank you!

Last edited by radoulov; 03-12-2011 at 05:35 AM.. Reason: Code tags, please!
# 2  
Old 03-12-2011
If you want a quick and dirty solution, given your sample input,
I would run something like this:

Code:
awk 'NF > 1' infile

If it doesn't work with your real input file,
give us a bigger and more representative sample.
# 3  
Old 03-12-2011
it works great!
thank you!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Joining broken lines and removing empty lines

Hi - I have req to join broken lines and remove empty lines but should NOT be in one line. It has to be as is line by line. The challenge here is there is no end of line/start of line char. thanks in advance Source:- 2003-04-34024|04-10-2003|Claims|Claim|01-13-2003|Air Bag:Driver;... (7 Replies)
Discussion started by: Jackceasar123
7 Replies

2. UNIX for Dummies Questions & Answers

How to delete some empty folders?

I have an amount of folders and I want to delete only the empty ones. But I have more than 200 empty folders, so I would preffer do not delete one by one... I know it is possible, but I don't know how. I've tried with the size, using 'du' command, and saving the result in a file. After that, I made... (3 Replies)
Discussion started by: saitsug
3 Replies

3. Shell Programming and Scripting

Sed delete certain number of empty lines

Hi What I'm trying to do is delete every blank line upto a certain number, so for instance I only want to delete the first 4 empty lines within a file, I know how to delete every line with: sed '/^$/d' But I can't figure out how to limit it to only the first 4 occourances I though it... (5 Replies)
Discussion started by: duonut
5 Replies

4. Shell Programming and Scripting

Script to delete empty files

I'm trying to write a shell script to files of zero length in a specified directory, but I keep getting errors. Would anybody be kind enough to look it over for issues? Thanks a bunch in advance. #!/bin/sh if then if then find $1 -type f -size 0 -print|xargs rm exit 0... (1 Reply)
Discussion started by: ScriptingIssues
1 Replies

5. Homework & Coursework Questions

Delete restore and empty trash

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: A set of Linux shell scripts is required to allow users to ‘remove' files without them really disappearing... (1 Reply)
Discussion started by: mr100perecent
1 Replies

6. Shell Programming and Scripting

How to delete all leading empty lines in a file?

How to delete all leading empty lines in a file? $>cat input.txt test Test $> output file should be test Test $> (14 Replies)
Discussion started by: johnveslin
14 Replies

7. Shell Programming and Scripting

delete empty spaces at specific column

Hi All, If anybody could help me with my scenario here. I have a statement file. Example of some content: DATE DESC Debit Credit Total Rate 02-Jan-08 Lodgement 200.00 1200.00 2.51 14-Sep-07 Withdrawal 50.00 1000.00 ... (8 Replies)
Discussion started by: yonez
8 Replies

8. Shell Programming and Scripting

Removing empty lines(space) between two lines containing strings

Hi, Please provide shell script to Remove empty lines(space) between two lines containing strings in a file. Input File : A1/EXT "BAP_BSC6/07B/00" 844 090602 1605 RXOCF-465 PDTR11 1 SITE ON BATTERY A2/EXT... (3 Replies)
Discussion started by: sudhakaryadav
3 Replies

9. UNIX for Advanced & Expert Users

How to delete empty lines

abc# abc#this is a test abc#this is a test to delete abc# xyz# xyz#this is a test two xyz# In the above example '#' is common. How to do delete the emply lines. In specific to observe the output as: abc#this is a test abc#this is a test to delete xyz#this is a test two . . . . (5 Replies)
Discussion started by: Aejaz
5 Replies

10. Shell Programming and Scripting

delete multiple empty lines

Hi, I need to delete the lines with empty name. What is the best way to do it? Thanks a lot for your help! EMID MMDDYY HOURS JOB EMNAME 0241 051605 11.40 52062 someone 0520 051605 10.63 52062 0520 051605 10.66 52062 0520 051605 10.65 52062 (3 Replies)
Discussion started by: whatisthis
3 Replies
Login or Register to Ask a Question