Hi
I have two files f1 and f2 and comma separated file.
I need to comapre two files by field by field and not by whole line.
If they match then skip the line from both the files. If they don't match
write the mismatch record from f1 to f3.
Assume both the files are sorted on first field.
Code:
f1
a1,a2,a3,a4,a5,a6
b1,b21,b31,b4,b5,b5
c1,c2,c3,c4,c5,c6
f2
a1,a2,a3,a4,a5,a6
b1,b2,b3,b4,b5,b6
c1,c2,c3,c4,c51,c61
d1,d2,d3,d4,d5,d6
The Output f3
b1,b21,b31,b4,b5,b6
c1,c2,c3,c4,c5,c6
I don't want to compare line by line , this may be required to tuke the data in some field.
I am just looking for Perl or unix script, how should I proceed about this.
Thanks
Dgmm
Welcome to the forum.
I could not get the grep to work, either.
On the other hand, I don't see where this line in f3 comes from:
hi i have two files and i want to compare both the files and find out mismatch in 3rd file
file1
00354|1|0|1|1|0|0|0|1|2
52424|1|0|1|1|0|0|0|1|2
43236|1|0|1|1|0|0|0|1|2
41404|1|0|1|1|0|0|0|1|2
79968|1|0|1|1|0|0|0|1|2
file2
00354|1|0|1|1|0|0|0|1|2
52424|1|0|1|1|0|0|0|0|2... (9 Replies)
i need to compare three files in unix
a.txt b.txt c.txt
1 2 1
2 5 3
4 6 5
5 6
6
i need to insert a blank line in the file if i don't find a match
and put the items at the same column if found a match
The items in the files... (4 Replies)
Using unix shell script, how to compare two files and print lines with mismatch? Below are the requirements:
1. The number of lines on the two files is not the same.
2. The difference/mismatch can be found on the second or third column.
3. The comparison is not between line 1 of file 1 and line... (16 Replies)
I have two files and would like a report of where they match.
Example of file1:
1 1 1
2 2 2
13 14 15
4 4 4
15 16 17
100 102 1004
56 57 890
Example of file2:
2 2 2
16 10 11
45 22 35
13 14 15
1001 1002 3456
100 102 1004 (1 Reply)
hi! i researched about comparing two columns here and got an answer. but after examining my two files, i found out that the first columns of the two files are not unique with each other. all i want to compare is the 2nd and 3rd column.
FILE 1:
ABS 456 315
EBS 923 163
JYQ3 654 237
FILE 2:... (1 Reply)
Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated.
script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made.
OS :Susi linux ver 10.3.
... (4 Replies)
Hi
I have used the below steps and found some discrepancies
step 1 :
find ./ -type f -mtime +7 -name "*.00*" | wc -l = 13519 ( total files )
( the size of this files is appx : 10GB )
step 2:
find ./ -type f -mtime +7 -name "*.00*" | xargs tar zcvf Archieve_7.tar.gz
step... (7 Replies)
Hi,
I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file.
File1 - file2 = file3
wc -l file1.txt
58112
wc -l file2.txt
55260
head -5 file1.txt
101214200123
101214700300
101250030067
101214100500... (10 Replies)
Hi Everyone,
I am comparing results of two environments using unix files.
I am writing two different csv file using spool and merging both the files using paste command
paste -d, file1.csv file2.csv > prod_uat_result.csv
and then finding the difference and attaching the same in a mail... (8 Replies)
I need to compare two files and find the mismatch columns in it for csv and fixed
width file.
Eg:
file1
c1,c2,c3,c4<----columnname
1,a,4,d
2,b,5,e
3,c,6,f
file2
c1,c2,c3,c4<----columnname
3,x,7,f
2,y,8,e
1,z,9,d
output
c2,c3<---- mismatch columname
a,4 x,7
b,5 or y,8 Ok with... (3 Replies)
Discussion started by: sabzR
3 Replies
LEARN ABOUT DEBIAN
dist::zilla::plugin::filefinder::byname
Dist::Zilla::Plugin::FileFinder::ByName(3pm) User Contributed Perl Documentation Dist::Zilla::Plugin::FileFinder::ByName(3pm)NAME
Dist::Zilla::Plugin::FileFinder::ByName - FileFinder matching on pathnames
VERSION
version 4.300020
SYNOPSIS
In your dist.ini:
[FileFinder::ByName / MyFiles]
dir = bin ; look in the bin/ directory
dir = lib ; and the lib/ directory
file = *.pl ; for .pl files
match = .pm$ ; and for .pm files
skip = ignore ; that don't have "ignore" in the path
DESCRIPTION
FileFinder::ByName is a FileFinder that selects files by matching the criteria you specify against the pathname.
There are three types of criteria you can use. "dir" limits the search to a particular directory. "match" is a regular expression that
must match the pathname. "skip" is a regular expression that must not match the pathname.
Each key can be specified multiple times. Multiple occurrences of the same key are ORed together. Different keys are ANDed together.
That means that to be selected, a file must be located in one of the "dir"s, must match one of the "match" regexs, and must not match any
of the "skip" regexs.
Note that "file" and "match" are considered to be the same key. They're just different ways to write a regex that the pathname must match.
Omitting a particular key means that criterion will not apply to the search. Omitting all keys will select every file in your dist.
Note: If you need to OR different types of criteria, then use more than one instance of FileFinder::ByName. A FileFinderUser should allow
you to specify more than one FileFinder to use.
ATTRIBUTES
dir
The file must be located in one of the specified directories (relative to the root directory of the dist).
file
The filename must match one of the specified patterns (which are converted to regexs using Text::Glob and combined with any "match" rules).
match
The pathname must match one of these regular expressions.
skip
The pathname must not match any of these regular expressions.
CREDITS
This plugin was originally contributed by Christopher J. Madsen.
AUTHOR
Ricardo SIGNES <rjbs@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.14.2 2012-06-21 Dist::Zilla::Plugin::FileFinder::ByName(3pm)