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.

Shell :copying the content from one file to another

Shell Programming and Scripting


Closed    
 
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: 27 November 2016, 7:12 PM EST
Posts: 76
Thanks: 21
Thanked 0 Times in 0 Posts
Shell :copying the content from one file to another

I have a log containing the below lines.
file1.log
-----------

Code:
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 
moduleRT100.3.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

file2.log

Code:
module1
module10
module2
module002
module9

Now file2 has to be generated from file1 by eliminating all module: and moduleRT etc. Only module that are postfixed with number has to be copied to file2.log

Could anyone please help me in this regard
Sponsored Links
    #2  
Old Unix and Linux 01-18-2013
Scrutinizer's Unix or Linux Image
Scrutinizer Scrutinizer is online now Forum Staff  
Moderator
 
Join Date: Nov 2008
Last Activity: 3 December 2016, 8:41 PM EST
Location: Amsterdam
Posts: 11,099
Thanks: 440
Thanked 3,107 Times in 2,748 Posts
Try:

Code:
grep -vE '^module(:|RT)' infile > outfile

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
To tar the content while copying files gsiva Shell Programming and Scripting 2 06-12-2012 01:05 AM
Copying the content of a filesystem to different Harddrive skamal4u Solaris 1 02-12-2009 12:14 AM
Copying the content of a filesystem to different Harddrive skamal4u UNIX for Dummies Questions & Answers 0 02-11-2009 07:18 PM
Copying selected content from file misenkiser Shell Programming and Scripting 1 10-05-2006 10:42 AM
copying content of a file talzohar UNIX for Dummies Questions & Answers 2 03-05-2005 10:16 PM



All times are GMT -4. The time now is 09:54 PM.