How to filter non matched ones


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to filter non matched ones
# 1  
Old 05-12-2009
How to filter non matched ones

INPUT1
a1tab234tabAQW
a2tab345tabQWE
a3tab567tab124
a4tab236tab890

INPUT2
a1tab234tabAQW
a4tab236tab890

OUTPUT
a2tab345tabQWE
a3tab567tab124
# 2  
Old 05-12-2009
comm -23 INPUT1 INPUT2
# 3  
Old 05-12-2009
@ repinementer

you need to sort both the files before doing comm on files.
# 4  
Old 05-12-2009
Do u guys have any better command.
It not joust doing the thign I want
Please
# 5  
Old 05-12-2009
Code:
egrep -v -f file2 file1

# 6  
Old 05-12-2009
Sorry to say

both commands are not working.
Coulkd you please help me on this
I'm here by attaching 2 input files.

input1 = cpccc.txt (contain some symbols)
input2 = notcpcc.txt (contain symbols in 1st input but not all)

output
need the symbols not present in second input

Thanx
# 7  
Old 05-12-2009
Try...
Code:
awk 'NR==FNR{a[$1]++;next}!a[$1]' cpccccc.txt notcpccccc.txt

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If 2nd column is matched

Both codes not working for me. whois nba.com| sed -n '/Registry Registrant ID:/,/Registrant whois ymas.com| sed -n '/Registry Registrant ID:/,/Registrant whois ymas.com.pt| sed -n '/Registry Registrant ID:/,/Registrant whois ymas.com.pt| sed -n '/Registry Admin ID:/,/Admin Email:/p' ... (5 Replies)
Discussion started by: kenshinhimura
5 Replies

2. UNIX for Dummies Questions & Answers

Filter records in a huge text file from a filter text file

Hi Folks, I have a text file with lots of rows with duplicates in the first column, i want to filter out records based on filter columns in a different filter text file. bash scripting is what i need. Data.txt Name OrderID Quantity Sam 123 300 Jay 342 498 Kev 78 2500 Sam 420 50 Vic 10... (3 Replies)
Discussion started by: tech_frk
3 Replies

3. UNIX for Advanced & Expert Users

Add a line after last matched expression

I thought this would be easy to Google, but I am having trouble getting a clean result that I can understand. I simply want to insert the the line: My Network 192.168.1.1 After the last line that begins with ACL localnet (15 Replies)
Discussion started by: glev2005
15 Replies

4. Shell Programming and Scripting

sed get matched string

Hi, how to figure out script name from a file which are having pattern .ksh. So wherever i have .ksh in a file i should get complete name of the file along with its extension as well. (7 Replies)
Discussion started by: vinsin55
7 Replies

5. Shell Programming and Scripting

Get header and its matched value in perl?

Hi, I have the file contents: Start,End,Req,Resp 12:39,12:40,4,5 The sting to be matched is: Req and Resp. parsefile("Req,Resp"); Here is the code. sub parsefile ($) { $header=shift; (2 Replies)
Discussion started by: vanitham
2 Replies

6. Shell Programming and Scripting

Matched by /\B/ in GNU awk

My GNU awk's version is 3.1.5, the special regexp operator '\B' can't work as expected. The document from "The GNU Awk User's Guide" It's my data file: ABCDE ABCD ABC AB A replaces all /\B/ with gsub: $ awk '{gsub(/\B/,"X")}1' data AXBXCXDE AXBXCD AXBC AXB A And, the expected... (2 Replies)
Discussion started by: redraiment
2 Replies

7. Shell Programming and Scripting

Get all the values matched in perl

HI, I have sentences like this: @str=("An ribonucleic acid (RNA)-binding protein, started its expression in the daughter cells","Elucidation of the mechanism of retinal degeneration of RNA-binding protein","Rna binding protein is an important protein","In the retinal degenerative process... (1 Reply)
Discussion started by: vanitham
1 Replies

8. Shell Programming and Scripting

Column matched in two files

I have two files with multiple columns separated by commas. I want to search one column from the first file in the second file; If there is a matching, will append that matched row to the first file. Let me show an example... (unique values in the search column) First file aa,reg1,bb,cc,dd,ff... (6 Replies)
Discussion started by: lalelle
6 Replies

9. Shell Programming and Scripting

How to get only matched contents?

Hi, I have an array. @arr=("abcdefgh","ppppppp","rrr"); $tofind="rrr";#string to find. I want to match this string and retrieve only matched contents. In this case rrr is found in 2nd position in an array i want to print only rrr. If the string is matched i have to retrieve only... (1 Reply)
Discussion started by: vanitham
1 Replies

10. Shell Programming and Scripting

How to get a next line of a matched word?

Hi , If I match a word in a file, I want to pick the next line of that matched word. My file is a below format- The ntrag trace has auditError Line5005 contains transaction Ntrag data ------------ Here I wanted if I match a word auditError, I need to get the next line "Line5005... (10 Replies)
Discussion started by: Muktesh
10 Replies
Login or Register to Ask a Question