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.

Shell : copying from one file to another file

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 01-18-2013
giridhar276 giridhar276 is offline
Registered User
 
Join Date: May 2011
Last Activity: 2 August 2014, 9:48 PM EDT
Posts: 73
Thanks: 20
Thanked 0 Times in 0 Posts
Shell : copying from one file to another file


Code:
vat.log
--------
null
null statistics
null
 

null
null
Storage Response Time
disk space1
disk space2

I have a log as mentioned above in which I need to copy only the below content to another file using shell scripting. In between null statistics and final null it also includes blank line as well..



Code:
null statistics
null
 

null
null


Could anyone please help me in this regard?

Thanks in advance...
Sponsored Links
    #2  
Old Unix and Linux 01-18-2013
Scott's Unix or Linux Image
Scott Scott is online now Forum Staff  
Administrator
 
Join Date: Jun 2009
Last Activity: 25 May 2015, 9:18 AM EDT
Location: Zürich
Posts: 8,552
Thanks: 337
Thanked 1,076 Times in 935 Posts

Code:
$ awk 'p&&$1&&$1!="null"{p=0}; /null statistics/ {p=1}p' file
null statistics
null
 

null
null

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
Copying Information from One File to Another File in Shell tamachan414 Shell Programming and Scripting 1 07-13-2011 04:27 PM
Help with searching for a file in a directory and copying the contents of that file in a new file zel2zel UNIX for Dummies Questions & Answers 6 03-05-2011 12:44 PM
sed command for copying the contents of other file replacing it another file on specifc pattern balrajg Shell Programming and Scripting 0 01-26-2011 09:42 PM
Strange difference in file size when copying LARGE file.. 0ktalmagik Filesystems, Disks and Memory 1 06-03-2006 07:34 PM
copying the csv file into different worksheets of xls file nimish Shell Programming and Scripting 0 10-03-2005 11:30 PM



All times are GMT -4. The time now is 09:26 AM.