matching file problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting matching file problem
# 1  
Old 07-23-2008
Bug matching file problem

hi
I need help for matching two files

a.txt
123,20080921,2419,ec1,20081021
456,20080923,2420,ec1,20081021
789,20080920,2419,ec1,20081021
124,20080921,2421,ec1,20081023
125,20080921,2419,ec1,20081021
126,20080921,2419,ec1,20081021
128,20080921,2419,ec1,20081021

b.txt

123,20080922,2419,ec1,20081021
456,20080923,2420,ec1,20081021
789,20080920,2418,ec1,20081021
124,20080921,2421,ec2,20081023
125,20080921,2419,ec1,20081021
126,20080921,2419,ec1,20081021
129,20080921,2419,ec1,20081021


I want to compare both files
i want the line of first file which is different from 2nd file in any of the field
like here first line differ in 2nd coloum value
simirly 3rd line differ in 3rd coloum value
last line is not in list so it should also come in output


output will be like
c.txt

123,20080921,2419,ec1,20081021
789,20080920,2419,ec1,20081021
124,20080921,2421,ec1,20081023
125,20080921,2419,ec1,20081021
126,20080921,2419,ec1,20081021
128,20080921,2419,ec1,20081021

these all line have atleast different value.
pls help ....
# 2  
Old 07-23-2008
Try...
Code:
paste a.txt b.txt | awk -F '\t' '$1!=$2 {print $1}'

# 3  
Old 07-23-2008
This sounds suspiciously like all you really want is "diff", perhaps with some strict line-position requirements?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pattern matching problem

if i have to do pattern match for file name with digit alphanumeric value like this File_1234.csv File_12sd45rg.csv i am using this File_*.csv and File_*.csv for digit pattern match. when i am doing pattern match for the digit then both alphanumeric match and digit match is coming. ... (3 Replies)
Discussion started by: ramsavi
3 Replies

2. Shell Programming and Scripting

Pattern matching problem

Hi I need a bash script that can search through a text file for all lines starting with 71502FSC1206 on every line it finds starting with this I need to place a letter F at the 127 position on that line. Thanks Paul (6 Replies)
Discussion started by: firefox2k2
6 Replies

3. Shell Programming and Scripting

Pattern matching and format problem

Hi I need a bash script that can search through a text file and when it finds 'FSS1206' I need to put a Letter F 100 spaces after the second instance of FSS1206 The format is the same throughout the file I need to repeat this on every time it finds the second 'FSS1206' in the file I have... (3 Replies)
Discussion started by: firefox2k2
3 Replies

4. Shell Programming and Scripting

pattern matching problem

# cat email.txt | grep -i "To:" To: <test@example.com> # cat email.txt | grep -i "Subject" Subject: Test Subject: How are you. I need to print only test@example.com from To field need to eliminate "< & >" from To field and need to print entire subject after Subject: It should be #... (7 Replies)
Discussion started by: mirfan
7 Replies

5. Shell Programming and Scripting

Chemistry problem- File matching and Sorting!!!

Dear Programmers I have a file called ranking.txt, in which I have 4 chemical compounds in *.sdf file format named ligands_m1, ligands_m2, ligands_m3, ligands_m4. Each compounds is assigned with a particular score along with the file location. ... (0 Replies)
Discussion started by: robertselwyne
0 Replies

6. Shell Programming and Scripting

AWK matching problem

hi i have a list as follow: where "aba" can be zero or one. I want match all "aba" and count how many are set to one. I mean in the previous case i should get just "2": I tried as follow: awk '/^aba/ BEGIN{i=0}{if($2==1) i=i+1}END{print i}' file but i get some errors. If i do: ... (4 Replies)
Discussion started by: Dedalus
4 Replies

7. Shell Programming and Scripting

pattern matching problem

FilesToBackup='*.track* *.xml *.vm* *.gz Trace* TRACE* "*core*" *.out fcif_data_* esi_error_* *.rollback *.sed R.* APStatus_* log* *.output* send_mail* downenv* check_env* intaspurge_db_* sqlnet.log *.rpt *.html *.csv "*TSC*"' and i am using it like this- echo Moving files from $(pwd): ... (2 Replies)
Discussion started by: namishtiwari
2 Replies

8. Shell Programming and Scripting

problem with CASE pattern matching

I am using ksh on a HP Ux. I have a simple script but am having problem with the case statement:- #!/usr/bin/sh Chl=”SM.APPLE_SWIFT_DV” LoConfirm=”” case $chl in ) LoConfirm=”Using channel at Building 1” echo “test conditon1” echo $LoConfirm;; ) LoConfirm=”Using... (2 Replies)
Discussion started by: gummysweets
2 Replies

9. Shell Programming and Scripting

pattern matching problem

I have a file with the following contents; NEW 85174 MP081 /29OCT07 CNL 85986 MP098 /28OCT07 NEW 86014 MP098 /28OCT07 NEW 86051 MP097 /27OCT07 CNL 86084 MP097 /27OCT07 Now I have to retrieve all lines that start with NEW and where the next line starts with CNL and where the MP codes are... (8 Replies)
Discussion started by: rein
8 Replies

10. Shell Programming and Scripting

Problem with pattren Matching

I have a set of programs and there coressponding MAPSETs i tried grep on the all the programs and got the following out put from this i want to extract only the Program Name and Mapset name {i.e. the word in (' ') after MAPSET } There or some cases where u have no ( after MAPSET that need... (7 Replies)
Discussion started by: pbsrinivas
7 Replies
Login or Register to Ask a Question