Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-06-2012
Registered User
 
Join Date: Dec 2012
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Need to remove a selection of rows separated by blank lines

hello, here is an example:


Code:
9.07
9.05
0.00
2.28
0.00
0.08
1.93
3.62
10.97

12.03
12.03
0.00
2.73
0.00
0.07
2.13
2.43
21.95

i wish to remove the first block of data, it is separated by blank lines above and below this. Please note that the data will constantly change with a new file so i am looking for a generic command not something that picks up specific numbers. I am relatively new to linux and i cant seem to figure out the exact command that needs to be used.
Sponsored Links
    #2  
Old 12-06-2012
Registered User
 
Join Date: Mar 2012
Location: Pune, India
Posts: 1,488
Thanks: 56
Thanked 426 Times in 422 Posts
It will print all the values after first blank line..

Code:
awk 'NR>1' RS= file

The Following User Says Thank You to pamu For This Useful Post:
Baron1 (12-06-2012)
Sponsored Links
    #3  
Old 12-06-2012
Registered User
 
Join Date: Dec 2012
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Thank you very much, it seemed to have worked. Testing it out now
    #4  
Old 12-06-2012
itkamaraj's Avatar
^Kamaraj^
 
Join Date: Apr 2010
Posts: 3,025
Thanks: 33
Thanked 647 Times in 625 Posts

Code:
awk 'NF==0{a=1}a' input.txt

Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Perl : blank lines are displayed in the output after deleting few rows from excel giridhar276 Shell Programming and Scripting 0 08-02-2012 07:46 AM
Text file to CSV with field data separated by blank lines vestport Shell Programming and Scripting 6 03-20-2012 05:56 AM
remove blank lines and merge lines in shell dvah Shell Programming and Scripting 11 03-09-2011 08:45 AM
How to remove Blank rows in a csv file cnraja Shell Programming and Scripting 6 01-13-2011 12:18 AM
Remove Blank Rows Vinsanity Shell Programming and Scripting 14 12-07-2010 10:05 AM



All times are GMT -4. The time now is 12:32 AM.