Delete record filter by column


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Delete record filter by column
# 1  
Old 03-30-2013
Delete record filter by column

Dear friend,

I have a file 2 files with column wise

FILE_A
------------------------------
Code:
x,1,@
y,3,$
x,5,%

FILE_B
--------------------
Code:
x,1,@

i like to delete the all lines in FILE_A ,if first column available in FILE_B.

output (in FILE_A)
Code:
y,3,$
x,5,%


quick reply must be appriciated.

Thanks,
Jewel

Last edited by Franklin52; 03-30-2013 at 11:31 AM.. Reason: Code tags
# 2  
Old 03-30-2013
Please use code tags for code and data as required by forum rules!

Your problem is such a common one that it has been discussed and solved umpteen times in these fora. Do an advanced search here, prepare a solution, and if that doesn't work as you need it, come back to discuss. We'll be here to help.

BTW, your specification does not fit your sample in-/output. Pls be more careful when phrasing either!
# 3  
Old 04-01-2013
Try like ..
Code:
 grep -vf a.txt b.txt

# 4  
Old 04-12-2013
hi friend,

can you please look into this.

regards,
Jewel
# 5  
Old 04-12-2013
The previous reply had the right idea:
Code:
$ cat FILE_A
x,1,@
y,3,$
x,5,%

$ cat FILE_B
x,1,@

$ grep -v -f FILE_B FILE_A
y,3,$
x,5,%

# 6  
Old 04-12-2013
Have u tried what i posted? facing any issue?
# 7  
Old 04-12-2013
Quote:
Have u tried what i posted? facing any issue?
I thought I had tried what you posted. Smilie I guess I must have missed something. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

CSV File:Filter duplicate records from column1 & another column having unique record

Hi Experts, I have csv file with 30, 40 columns Pasting just 2 column for problem description. Need to print error if below combination is not present in file check for column-1 (DocumentNumber) and filter columns where value in DocumentNumber field is same. For all such rows, the field... (7 Replies)
Discussion started by: as7951
7 Replies

2. Shell Programming and Scripting

Filter and delete numbers in a list

Hello, I've got a list of a single column numbers like 3000.66 3002.55 3062.23 3242.12 etc... I would like to delete all numbers higher than for example 3060.00 and lower than 2990.00 How can I do that? Thanks in advance (2 Replies)
Discussion started by: Board27
2 Replies

3. Shell Programming and Scripting

Split column data if the table has n number of column's with some record

Split column data if the table has n number of column's with some record then how to split n number of colmn's line by line with records Table --------- Col1 col2 col3 col4 ....................col20 1 2 3 4 .................... 20 a b c d .................... v ... (11 Replies)
Discussion started by: Priti2277
11 Replies

4. UNIX for Dummies Questions & Answers

Match sum of values in each column with the corresponding column value present in trailer record

Hi All, I have a requirement where I need to find sum of values from column D through O present in a CSV file and check whether the sum of each Individual column matches with the value present for that corresponding column present in the trailer record. For example, let's assume for column D... (9 Replies)
Discussion started by: tpk
9 Replies

5. Shell Programming and Scripting

Filter on one column and then perform conditional calculations on another column with a Linux script

Hi, I have a file (stats.txt) with columns like in the example below. Destination IP address, timestamp, TCP packet sequence number and packet length. destIP time seqNo packetLength 1.2.3.4 0.01 123 500 1.2.3.5 0.03 44 1500 1.3.2.5 0.08 44 1500 1.2.3.4 0.44... (12 Replies)
Discussion started by: Zooma
12 Replies

6. Shell Programming and Scripting

awk-filter record by another file

I have file1 3049 3138 4672 22631 45324 112382 121240 125470 130289 186128 193996 194002 202776 228002 253221 273523 284601 284605 641858 (8 Replies)
Discussion started by: biomed
8 Replies

7. Shell Programming and Scripting

Filter record from a file

Reposting since I didnt not get any reply. I have a problem while filtering records from a file. Can somebody help please? For eg: Consider the below files Record file: 0003@00000000000190@20100401@201004012010040120100401@003@... (1 Reply)
Discussion started by: gpaulose
1 Replies

8. Shell Programming and Scripting

Help in writing a KSH script to filter the latest record?

Hi All, I have a text file with the folowing content. BANGALORE|1417|2010-02-04 08:41:04.174|dob|xxx BANGALORE|1416|2010-02-04 08:23:19.566|dob|yyy BANGALORE|1415|2010-02-04 08:20:14.497|dob|aaa BANGALORE|1414|2010-02-04 08:19:40.065|dob|vvv BANGALORE|1413|2010-02-04... (4 Replies)
Discussion started by: Karpak
4 Replies

9. Shell Programming and Scripting

filter the uniq record problem

Anyone can help for filter the uniq record for below example? Thank you very much Input file 20090503011111|test|abc 20090503011112|tet1|abc|def 20090503011112|test1|bcd|def 20090503011131|abc|abc 20090503011131|bbc|bcd 20090503011152|bcd|abc 20090503011151|abc|abc... (8 Replies)
Discussion started by: bleach8578
8 Replies

10. Shell Programming and Scripting

filter based on column value

I have a file with colon separated values.. the sample is attached below. No of fields in each record/line is dependent on the value of field53. What I need to do is to design a special filter based on specific requirement of some match of values in particular column or combination of columns. ... (2 Replies)
Discussion started by: rraajjiibb
2 Replies
Login or Register to Ask a Question