Search--Compare--Redirect


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Search--Compare--Redirect
# 1  
Old 09-27-2006
Search--Compare--Redirect

Hai Guru's,

I have 3 files.A,B,C

The file A,B is very huge.What i need to do is...I just get each record from file A and compare with File B...if the record presents...redirect the record to File C..otherwise not needed...

Kindly give me ur valuable suggestions to resolve the above problem....

Satheesh.Rajan
# 2  
Old 09-27-2006
Code:
man comm

Example (using bash, which supports process redirection)

Code:
$ cat > file_1
one
two
three
four
$ cat > file_2
three
four
five
six
$ comm -12 <( sort file_1 ) <( sort file_2 ) > file_3
$ cat file_3
four
three

Cheers
ZB
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search every line and compare fields

Hi All, I have situation where my file looks like this log.file. ID Start time IP SQL 1256152 05-Aug-15, 11:25:06 MST 10.54.20.33 Select * from TES 1004768 05-Aug-15, 11:25:06 MST 10.54.20.33 Select dummy 323323 05-Aug-15, 12:00:06 MST 10.15.20.77 ... (1 Reply)
Discussion started by: netdbaind
1 Replies

2. Shell Programming and Scripting

Search and compare files from two paths

Hi All, I have a 2 path, one with oldfile path in which has several sub folders,each sub folders contains a config file(basically text file), likewise there will be another newfile path which will have sub folders, each sub folders contains a config file. Need to read files from oldfile... (6 Replies)
Discussion started by: Optimus81
6 Replies

3. Shell Programming and Scripting

Need script to compare and redirect

Hi, I have a file, sol_servers_global, which is list of all solaris global servers in my environment and another file, solaris_non_global_zones_from_DB. I have a gateway server, from where all servers are contactable via ssh. I have collected name of zones running on these servers with below... (3 Replies)
Discussion started by: solaris_1977
3 Replies

4. Shell Programming and Scripting

Search compare and determine duplicate files

Hi May i ask if someone know a package that will search a directory recursively and compare determine duplicate files according to each filename, date modified or any attributes that will determine its duplicity If none where should i start or what are those command in shell scripting that... (11 Replies)
Discussion started by: jao_madn
11 Replies

5. Shell Programming and Scripting

Help with Compare and search content in directory

Hello, How to search in directory by comparing some string with the content of directory. Ex: I want to compare abhi string with the content of backup directory. i.e want to check that is there any file in backup directory having name ... (3 Replies)
Discussion started by: AbhijitIT
3 Replies

6. Shell Programming and Scripting

How to search & compare paragraphs between two files

Hello Guys, Greetings to All. I am stuck in my work here today while trying to comapre paragraphs between two files, I need your help on urgent basis, without your inputs I can not proceed. Kindly find some time to answer my question, I'll be grateful to you for ever. My detailed issue is as... (10 Replies)
Discussion started by: NARESH1302
10 Replies

7. Shell Programming and Scripting

to search a string and redirect according to output

i have a file (kk.log) in which following contents are there: ===================================== Enter:YOU HAVE ENTERED : a TestCase: TC1226677371 IS PASSED 2009-02-25 13:57:33.444 INFO com.t.t.exporterporter - Initialising Xml Exporter.... 2009-02-25 13:57:33.445 INFO ... (2 Replies)
Discussion started by: Aditya.Gurgaon
2 Replies

8. Shell Programming and Scripting

compare and redirect to new file

hi i have two file a.txt 123,b,c,d,e 111,c,d,e,f, 456,a,k,j,h b.txt 123 678 987 321 456 i want to compare these two files(match content of b first coloum with a ) and o/p should be like 123,d,e 456,j,h pls help.....:) (7 Replies)
Discussion started by: anish19
7 Replies

9. Shell Programming and Scripting

Perl: Search for string on line then compare numbers!

Hi All, I have a file that I need to be able to find a pattern match on a line, take the number on that line check if its >0.9 or <0.1 and if this is true write the line to output.out file. An example of 4 lines in my file is: 1. driver.I177.I11.net010 1.48622200477273e-05 2.... (2 Replies)
Discussion started by: Crypto
2 Replies

10. UNIX for Dummies Questions & Answers

Search, compare or?

I found this very helpful forum and there are very friendly people, I have a small request. I use AIX Unix and would like to know if there's a simple way how to do a kind of compare between two files. I have 2 text files, let's name them file1 and file2. What I need: I want to read... (2 Replies)
Discussion started by: netrom
2 Replies
Login or Register to Ask a Question