The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
mutliple files in the same directory epi8 Shell Programming and Scripting 8 05-12-2008 11:04 PM
process mutliple files in the same directory epi8 UNIX for Dummies Questions & Answers 1 05-12-2008 11:43 AM
How to split a field into two fields? vbrown Shell Programming and Scripting 4 02-21-2008 03:50 AM
can Awk split my field on the . oly_r Shell Programming and Scripting 6 10-26-2007 04:16 PM
Split a field in awk script CamTu Shell Programming and Scripting 4 03-21-2005 01:03 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #8  
Old 04-22-2008
Registered User
 

Join Date: Apr 2008
Posts: 14
Thanks for the help era. But one more requirment needs to be included in the coding.

if we did not find any match for the given input from the file then it should not write a blank file.

waiting for you replay

Thanks
Arun
Reply With Quote
Forum Sponsor
  #9  
Old 04-22-2008
Registered User
 

Join Date: Apr 2008
Posts: 14
Could Somebody give me the Code.
Thanks
Arun
Reply With Quote
  #10  
Old 04-22-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Actually it's much simpler if you simply remove any zero-sized file after you're done. Would that be acceptable?

Code:
test -s have.not || rm have.not
Incidentally, it's against the forum rules to "bump" questions. Expecting, or even demanding a reply within the hour is not very realistic.
Reply With Quote
  #11  
Old 04-22-2008
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
Quote:
Originally Posted by arund_01 View Post
Could Somebody give me the Code.
Thanks
Arun
Bumping up posts is against the Rules.
Reply With Quote
  #12  
Old 04-22-2008
Registered User
 

Join Date: Apr 2008
Posts: 14
thank you so much era.
Reply With Quote
  #13  
Old 04-23-2008
Registered User
 

Join Date: Apr 2008
Posts: 14
Hi era,

after exceuting the command egrep 'first|second|third' file1 file2 file3 >have. the output file is showing different values with the filename at the begening of each and every line. example is given below.

content of file 1

arun RD002136823 1
madhu 11111111111 2
srini RD002136823 3
syam 22222222222 4
gauth 33333333333 5
laxmi 44444444444 6
ranjit RD002136823 7
ranga 5555555555 8
pmsat 66666666 9

content of file2 is

subbu RD002136823 1
anil 11111111111 2
raju RD002136823 3
vaga 22222222222 4
kotra 33333333333 5
adapa 44444444444 6
amith RD002136823 7
arora 5555555555 8
vestha 66666666 9

after the command egrep RD002136823 $FILE1 $FILE2 > $FILE3

the out is like below

arigmrec01.in:arun RD002136823 1
arigmrec01.in:srini RD002136823 3
arigmrec01.in:ranjit RD002136823 7
arigmrec03.in:subbu RD002136823 1
arigmrec03.in:raju RD002136823 3
arigmrec03.in:amith RD002136823 7

but i don't want the file name to come in the begening of each line. i need only the content of from both the files into another file.

Waiting for ur replay.

Thanks
Arun
Reply With Quote
  #14  
Old 04-23-2008
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
doing 'man egrep' yields :
Code:
       -h, --no-filename
              Suppress  the  prefixing  of  filenames  on output when multiple
              files are searched.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
regex, regular expressions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 07:58 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0