Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Need to remove a selection of rows separated by blank lines

Shell Programming and Scripting


Closed    
 
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: 8 August 2016, 12:07 PM 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  
Registered User
 
Join Date: Apr 2010
Last Activity: 2 December 2016, 3:48 AM EST
Posts: 3,126
Thanks: 43
Thanked 684 Times in 660 Posts

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

Sponsored Links
Closed

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 08:46 AM
Text file to CSV with field data separated by blank lines vestport Shell Programming and Scripting 6 03-20-2012 06:56 AM
remove blank lines and merge lines in shell dvah Shell Programming and Scripting 11 03-09-2011 09:45 AM
How to remove Blank rows in a csv file cnraja Shell Programming and Scripting 6 01-13-2011 01:18 AM
Remove Blank Rows Vinsanity Shell Programming and Scripting 14 12-07-2010 11:05 AM



All times are GMT -4. The time now is 10:49 PM.