The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
grep a string on all files in the subdirectories *Jess* SUN Solaris 4 05-15-2007 10:04 AM
Appending to filename a string of text grep finds HLee1981 Shell Programming and Scripting 3 09-06-2005 03:44 PM
grep multiple text files in folder into 1 text file? coppertone UNIX for Dummies Questions & Answers 7 08-23-2002 03:50 PM
Update text files in place (string substitution) ?? kornshellmaven UNIX for Dummies Questions & Answers 1 07-17-2001 12:11 AM
grep'ing for text within a bunch of files...? kitykity UNIX for Dummies Questions & Answers 1 09-19-2000 09:50 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 04-22-2008
karthikn7974's Avatar
karthikn7974 karthikn7974 is offline VIP Member  
Supporter
  
 

Join Date: Jul 2007
Location: Singapore
Posts: 58
Lightbulb grep a string from 2 text files

How to grep a string in two different files,

I am having the following scenario

TextFile1
Code:
Date (dd/mm)Time      Server        IP                       Error Code
===========================================================================
10/04/2008   10:10     ServerA    xxx.xxx.xxx.xxx             6	
10/04/2008   10:10     ServerB    xxx.xxx.xxx.xxx             9	
10/04/2008   10:10     ServerC    xxx.xxx.xxx.xxx             16	
10/04/2008   10:10     ServerD    xxx.xxx.xxx.xxx             60

TextFile2

Code:
Date (dd/mm)Time      Server        IP                    Error Code
=======================================================================
09/04/2008   10:10     ServerA    xxx.xxx.xxx.xxx             0	
09/04/2008   10:10     ServerB    xxx.xxx.xxx.xxx             0	
09/04/2008   10:10     ServerC    xxx.xxx.xxx.xxx             0	
08/04/2008   10:10     ServerA    xxx.xxx.xxx.xxx             0	
08/04/2008   10:10     ServerB    xxx.xxx.xxx.xxx             0	
08/04/2008   10:10     ServerC    xxx.xxx.xxx.xxx             0	
07/04/2008   10:10     ServerA    xxx.xxx.xxx.xxx             0	
07/04/2008   10:10     ServerB    xxx.xxx.xxx.xxx             0	
07/04/2008   10:10     ServerC    xxx.xxx.xxx.xxx             0

grep the date for server A with error code = 0 into output.txt
the output should be the previous date or the latest in which the error code =0

output.txt
09/04/2008
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:04 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0