Shell : copying from one file to another file | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


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

Shell : copying from one file to another file

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 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 01-18-2013
Scott's Avatar
Scott Scott is offline Forum Staff  
Administrator
 
Join Date: Jun 2009
Last Activity: 24 October 2014, 10:03 PM EDT
Location: Zürich
Posts: 8,484
Thanks: 332
Thanked 1,047 Times in 914 Posts

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

null
null

Sponsored Links
Closed Thread

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
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 11:32 PM.