Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

Need to remove a selection of rows separated by blank lines

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 12-06-2012
Baron1 Baron1 is offline
Registered User
 
Join Date: Dec 2012
Last Activity: 7 December 2012, 6:50 AM EST
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 Unix and Linux 12-06-2012
pamu pamu is offline
Registered User
 
Join Date: Mar 2012
Last Activity: 27 May 2015, 11:47 AM EDT
Posts: 1,650
Thanks: 58
Thanked 478 Times in 474 Posts
It will print all the values after first blank line..Linux

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 Unix and Linux 12-06-2012
Baron1 Baron1 is offline
Registered User
 
Join Date: Dec 2012
Last Activity: 7 December 2012, 6:50 AM EST
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 Unix and Linux 12-06-2012
itkamaraj's Unix or Linux Image
itkamaraj itkamaraj is offline Forum Advisor  
^Kamaraj^
 
Join Date: Apr 2010
Last Activity: 25 June 2015, 3:24 AM EDT
Posts: 3,060
Thanks: 34
Thanked 661 Times in 640 Posts

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

Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 04:27 AM.