Shell :copying the content from one file to another | 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 the content from one file to another

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 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 01-18-2013
Scrutinizer's Avatar
Scrutinizer Scrutinizer is offline Forum Staff  
Moderator
 
Join Date: Nov 2008
Last Activity: 22 October 2014, 8:25 PM EDT
Location: Amsterdam
Posts: 9,538
Thanks: 284
Thanked 2,422 Times in 2,172 Posts
Try:

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

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



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