Shell : copying from one file to another file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell : copying from one file to another file
# 1  
Old 01-18-2013
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...
# 2  
Old 01-18-2013
Code:
$ awk 'p&&$1&&$1!="null"{p=0}; /null statistics/ {p=1}p' file
null statistics
null
 

null
null

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copying a file to multiple other files using a text file as input

Hello, I have a file called COMPLIST as follows that contains 4 digit numbers.0002 0003 0010 0013 0015 0016 0022 0023 0024 0025 0027 0030 0031 0032 0033 0035 0038 0041 (3 Replies)
Discussion started by: sph90457
3 Replies

2. Shell Programming and Scripting

Shell Script for copying text file to Excel Sheet

Hi, I want to write a program to copy a log file to Excel sheet. Excel sheet has four columns MethodName , Code , Description, Details and Time. I want to pick these info from text file and put it in excel sheet. here is how the text file looks - 04.17.2014 08:06:12,697... (1 Reply)
Discussion started by: hershey
1 Replies

3. Shell Programming and Scripting

Copying a string from a file using shell script

Hello everyone I am completely new to shell scripting in linux. I wan to write a script to search for a certain string from a .txt file and copy the string which apears just after tat searched string. Eg: in a file- try.txt , we have a line saying: "roses are red, so what do i do" I... (4 Replies)
Discussion started by: Kishore920
4 Replies

4. Shell Programming and Scripting

Shell :copying the content from one file to another

I have a log containing the below lines. file1.log ----------- module: module1 module10 module2 module002 module9 moduleRT100.2.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... (1 Reply)
Discussion started by: giridhar276
1 Replies

5. Shell Programming and Scripting

Copying Information from One File to Another File in Shell

Hello, I'm new to scripting and I need help moving text from one file to another file. Here are examples what the files look like. File 1: Ac-223 2.10m A 1 0 0 0 Fr-219 358 9.9000E-01 0 0.0 0 0.0 0 0.0... (1 Reply)
Discussion started by: tamachan414
1 Replies

6. UNIX for Dummies Questions & Answers

Help with searching for a file in a directory and copying the contents of that file in a new file

Hi guys, I am a newbie here :wall: I need a script that can search for a file in a directory and copy the contents of that file in a new file. Please help me. :confused: Thanks in advance~ (6 Replies)
Discussion started by: zel2zel
6 Replies

7. Shell Programming and Scripting

sed command for copying the contents of other file replacing it another file on specifc pattern

We have 2 file XML files - FILE1.XML and FILE2.xml - we need copy the contents of FILE1.XML and replace in FILE2.xml pattern "<assignedAttributeList></assignedAttributeList>" FILE1.XML 1. <itemList> 2. <item type="Manufactured"> 3. <resourceCode>431048</resourceCode> 4. ... (0 Replies)
Discussion started by: balrajg
0 Replies

8. Programming

Copying and overwriting a file using file descriptor

Hi , i have two basic requirement on linux platform . I am using C language to do this . 1) copying one file to another (assuming i know their file descriptors) 2) Overwriting a file using it file descriptor . Please guide. regards Aki (2 Replies)
Discussion started by: meet123321
2 Replies

9. Filesystems, Disks and Memory

Strange difference in file size when copying LARGE file..

Hi, Im trying to take a database backup. one of the files is 26 GB. I am using cp -pr to create a backup copy of the database. after the copying is complete, if i do du -hrs on the folders i saw a difference of 2GB. The weird fact is that the BACKUP folder was 2 GB more than the original one! ... (1 Reply)
Discussion started by: 0ktalmagik
1 Replies

10. Shell Programming and Scripting

copying the csv file into different worksheets of xls file

Hi, I have a script which will generate three csv files. i want to copy the contents of these csv files into a .XLS file but in different worksheets. Can a this be done in the same script? :confused: Can Perl come to my help in coping the csv files into different worksheets of .XLS file ?... (0 Replies)
Discussion started by: nimish
0 Replies
Login or Register to Ask a Question