Copying selected content from file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Copying selected content from file
# 1  
Old 10-05-2006
Copying selected content from file

I want to capture contents of a file between 2 strings into another file

for eg all lines in between the keywords "start log" and "end log" should be copied into another file
# 2  
Old 10-05-2006
See the man page for awk.

cat yourfile |awk /"start log"/,/"end log"/ > newfile (note that this will put the start log and end log in the file also)
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Reading and copying a selected rows

Dear All, I have a data file input.res like below. (Only six column shown here for example.) Sequence of first column starting from 1 to 148. Input file 1 Q0 9_August_2014_Entertainment2 0 20.14967806339729 BM25b1.0 1 Q0 13_October_2012_Page323 1 20.134224346765738 BM25b1.0 1 Q0... (2 Replies)
Discussion started by: imranrasheedamu
2 Replies

2. 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

3. Shell Programming and Scripting

Copying lines from multiple logfiles, based on content of the line

d df d d (1 Reply)
Discussion started by: larsk
1 Replies

4. Shell Programming and Scripting

To tar the content while copying files

Any idea on how we can tar the content while copying the files from one location to another location using the bash script. (2 Replies)
Discussion started by: gsiva
2 Replies

5. Shell Programming and Scripting

copying selected records from two columns to another file

Hey guys I have got a tab-separated file and I want to copy only selected records from two columns at a time satisfying specified condition, and create a new file. My tab separated file is like this ID score ID score ID Score ID score ID score 1_11 0.80 2_23 0.74 2.36 0.78 2_34 0.75 A_34... (9 Replies)
Discussion started by: jacks
9 Replies

6. Solaris

Copying the content of a filesystem to different Harddrive

my server runs solaris 10 , one of the partition in my primary harddrive is 99% full , i want to move the contents of it to the second harddrive which has higher capacity. what is the best way to move the contents to 2nd drive ? which command should i use cpio/dd/tar/ufsdump .... please guide me... (1 Reply)
Discussion started by: skamal4u
1 Replies

7. UNIX for Dummies Questions & Answers

Copying the content of a filesystem to different Harddrive

my server runs solaris 10 , one of the partition in my primary harddrive is 99% full , i want to move the contents of it to the second harddrive . what is the best way to move the contents to 2nd drive ? which command should i use cpio/dd/tar/ufsdump .... please guide me with the command and the... (0 Replies)
Discussion started by: skamal4u
0 Replies

8. Shell Programming and Scripting

csv content to call out selected function

Hi .. I am new to shell scripting I need to extract data from a csv file to call out selected function Sample contents of CSV PWR_JB, TB, Hk101, CB, Status,A PWR_JB, TB, HK101, OS, Status,B PWR_JB, 88V,SG201, OS, Status,B PWR_JB, TB, SG402, CB, Status,A PWR_JB, 88V,SG202,... (0 Replies)
Discussion started by: piresz
0 Replies

9. UNIX for Dummies Questions & Answers

copying content of a file

Hi, I have a file in my unix system let's call it FileName. First I want to copy its content into a another file, but outside of the unix, meaning I could open it at home. (text file would be perfect) Second (if it's possible) I need to take the first word of each line in the file (you know... (2 Replies)
Discussion started by: talzohar
2 Replies
Login or Register to Ask a Question