Sponsored Content
Full Discussion: Compare fields in files
Top Forums Shell Programming and Scripting Compare fields in files Post 302595940 by umastinu on Monday 6th of February 2012 03:18:21 AM
Old 02-06-2012
Is there multiple files like file1,2,3 and so on?
Is there a way to do this in python.

Thanks in advance,
Uma
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compare two files based on values of fields.

Hi All, I have two files and data looks like this: File1 Contents #Field1,Field2 Dist_Center_file1.txt;21 Dist_Center_file3.txt;20 Dist_Center_file2.txt;20 File2 Contents (*** No Header ***) Dist_Center_file1.txt;23 Dist_Center_file2.txt;20 Dist_Center_file3.txt;20 I have... (4 Replies)
Discussion started by: Hangman2
4 Replies

2. Shell Programming and Scripting

Compare fields in 2 files using AWK

Hi unix gurus, I have a urgent requirement, I need to write a AWK script to compare each fields in 2 files using AWK. Basically my output should be like this. file1 row|num1|num2|num3 1|one|two|three 2|one|two|three file2 row|num1|num2|num3 1|one|two|three 2|one|two|four ... (5 Replies)
Discussion started by: rashmisb
5 Replies

3. Shell Programming and Scripting

AWK Compare files, different fields, output

Hi All, Looking for a quick AWK script to output some differences between two files. FILE1 device1 1.1.1.1 PINGS device1 2.2.2.2 PINGS FILE2 2862 SITE1 device1-prod 1.1.1.1 icmp - 0 ... (4 Replies)
Discussion started by: stacky69
4 Replies

4. Shell Programming and Scripting

Compare files with fields separated with semicolon

Dear experts I have files like ABD : 5869 events, relative ratio : 1.173800E-01 , sum of ratios : 1.173800E-01 VBD : 12147 events, relative ratio : 2.429400E-01 , sum of ratios : 3.603200E-01 SDF : 17000 events, relative ratio : 3.400000E-01 , sum of ratios : 7.003200E-01 OIP: 14984... (9 Replies)
Discussion started by: Alkass
9 Replies

5. Shell Programming and Scripting

compare fields in different files

HI I'm having some troubles to compare and permut diffrent fields indexed with another filed like the following example `: file1 1 1 2 2 3 3 file2 7 1 9 2 10 3 result------------------- (6 Replies)
Discussion started by: yassinegoth
6 Replies

6. Shell Programming and Scripting

Compare two fields in text files?

Hi, I have two text files, compare column one in both the files and if it matches then the output should contain the id in column one, the number and the description. Both the files are sorted. Is there a one liner to get this done, kindly help. Thank you File 1: NC_000964 92.33 ... (2 Replies)
Discussion started by: pulikoti
2 Replies

7. Shell Programming and Scripting

Compare three files based on two fields

Guys, I tried searching on the internet and I couldn't get the answer for this problem. I have 3 files. First 2 fields of all of them are of same type, say they come from various databases but first two fields in the 3 files means the same. I need to verify the entries that are not present... (4 Replies)
Discussion started by: PikK45
4 Replies

8. UNIX for Dummies Questions & Answers

Compare 2 fields in 2 files

I am trying to compare two files (separted by a pipe) using 2 fields (field 1,3 from fileA and 1,2 from fileB) if the two files match i want the whole record of fileA adding the extra fields left from fileB. 1. A.txt cat|floffy|12|anything|anythings cat|kitty|15|lala|lalala... (6 Replies)
Discussion started by: sabercats
6 Replies

9. Shell Programming and Scripting

Compare fields in two files

Hi, I am trying to check two files based on certain string and field. cat f1 source=\GREP\" hi this \\ source=\SED\" skdmsmd dnksdns source=\PERL\" cat f2 source=\SED\" source=\GREP\" vlamskds amdksk m source=\AWK\" awk \here\" (3 Replies)
Discussion started by: greet_sed
3 Replies

10. UNIX for Beginners Questions & Answers

Is there a UNIX command that can compare fields of files with differing number of fields?

Hi, Below are the sample files. x.txt is from an Excel file that is a list of users from Windows and y.txt is a list of database account. $ head -500 x.txt y.txt ==> x.txt <== TEST01 APP_USER_PROFILE USER03 APP_USER_PROFILE TEST02 APP_USER_EXP_PROFILE TEST04 APP_USER_PROFILE USER01 ... (3 Replies)
Discussion started by: newbie_01
3 Replies
DEBDIFF(1)						      General Commands Manual							DEBDIFF(1)

NAME
       debdiff - compare file lists in two Debian packages

SYNOPSIS
       debdiff [options]
       debdiff [options] ... deb1 deb2
       debdiff [options] ... changes1 changes2
       debdiff [options] ... --from deb1a deb1b ...  --to deb2a deb2b ...
       debdiff [options] ... dsc1 dsc2

DESCRIPTION
       debdiff takes the names of two Debian package files (.debs or .udebs) on the command line and compares their contents (considering only the
       files in the main package, not the maintenance scripts).  It shows which files have been introduced and which removed between the two pack-
       age  files,  and  is  therefore useful for spotting files which may have been inadvertently lost between revisions of the package.  It also
       checks the file owners and permissions, and compares the control files of the two packages using the wdiff program.

       If no arguments are given, debdiff tries to compare the content of the current source directory with the last version of the package.

       debdiff can also handle changes between groups of .deb files in two ways.  The first is to specify two .changes files.  In this	case,  the
       .deb  files listed in the .changes file will be compared, by taking the contents of all of the listed .deb files together.  (The .deb files
       listed are assumed to be in the same directory as the .changes file.)  The second way is to list the .deb files	of  interest  specifically
       using the --from ... --to syntax.  These both help if a package is broken up into smaller packages and one wishes to ensure that nothing is
       lost in the interim.

       debdiff examines the devscripts configuration files as described below.	Command line options override  the  configuration  file  settings,
       though.

       If  debdiff  is passed two source packages (.dsc files) it will compare the contents of the source packages.  If the source packages differ
       only in Debian revision number (that is, the .orig.tar.gz files are the same in the two .dsc files), then interdiff(1) will be used to com-
       pare the two patch files if this program is available on the system, otherwise a diff will be performed between the two source trees.

OPTIONS
       --dirs, -d
	      The  default mode of operation is to ignore directory names which appear in the file list, but they, too, will be considered if this
	      option is given.

       --nodirs
	      Ignore directory names which appear in the file list.  This is the default and it can be used to override a configuration file  set-
	      ting.

       --move FROM TO, -m FROM TO
	      It  sometimes  occurs  that various files or directories are moved around between revisions.  This can be handled using this option.
	      There are two arguments, the first giving the location of the directory or file in the first package, and the second in the  second.
	      Any files in the first listing whose names begin with the first argument are treated as having that substituted for the second argu-
	      ment when the file lists are compared.  Any number of --move arguments may be given; they are processed in the order in  which  they
	      appear.

       --move-regex FROM TO
	      This  is	the  same  as --move, except that FROM is treated as a regular expression and the perl substitution command s/^FROM/TO/ is
	      applied to the files.  In particular, TO can make use of backreferences such as $1.

       --nocontrol
	      debdiff will usually compare the respective control files of the packages using wdiff(1).  This option suppresses this part  of  the
	      processing.

       --control
	      Compare the respective control files; this is the default, and it can be used to override a configuration file setting.

       --controlfiles FILE[,FILE ...]
	      Specify  which  control files to compare; by default this is just control, but could include postinst, config and so on.	Files will
	      only be compared if they are present in both .debs being compared.  The special value ALL compares all control files present in both
	      packages, except for md5sums.  This option can be used to override a configuration file setting.

       --wdiff-source-control
	      When processing source packages, compare control files using wdiff.  Equivalent to the --control option for binary packages.

       --no-wdiff-source-control
	      Do not compare control files in source packages using wdfiff.  This is the default.

       --wp, --wl, --wt
	      Pass a -p, -l or -t option to wdiff respectively.  (This yields the whole wdiff output rather than just the lines with any changes.)

       --show-moved
	      If  multiple  .deb  files are specified on the command line, either using .changes files or the --from/--to syntax, then this option
	      will also show which files (if any) have moved between packages.	(The package names are simply determined from  the  names  of  the
	      .deb files.)

       --noshow-moved
	      The default behaviour; can be used to override a configuration file setting.

       --renamed FROM TO
	      If  --show-moved is being used and a package has been renamed in the process, this command instructs debdiff to treat the package in
	      the first list called FROM as if it were called TO.  Multiple uses of this option are permitted.

       --exclude PATTERN
	      Exclude files that match PATTERN.  Multiple uses of this option are permitted.

       --diffstat
	      Include the result of diffstat before the generated diff.

       --no-diffstat
	      The default behaviour; can be used to override a configuration file setting.

       --auto-ver-sort
	      When comparing source packages, do so in version order.

       --no-auto-ver-sort
	      Compare source packages in the order they were passed on the command-line, even if that means comparing a package with a higher ver-
	      sion against one with a lower version.  This is the default behaviour.

       --unpack-tarballs
	      When  comparing  source  packages, also unpack tarballs found in the top level source directory to compare their contents along with
	      the other files.	This is the default behaviour.

       --no-unpack-tarballs
	      Do not unpack tarballs inside source packages.

       --no-conf, --noconf
	      Do not read any configuration files.  This can only be used as the first option given on the command-line.

       --help, -h
	      Show a summary of options.

       --version, -v
	      Show version and copyright information.

       --quiet, -q
	      Be quiet if no differences were found.

       --ignore-space, -w
	      Ignore whitespace in diffs.

CONFIGURATION VARIABLES
       The two configuration files /etc/devscripts.conf and ~/.devscripts are sourced by a shell in that order	to  set  configuration	variables.
       Command line options can be used to override configuration file settings.  Environment variable settings are ignored for this purpose.  The
       currently recognised variables are:

       DEBDIFF_DIRS
	      If this is set to yes, then it is the same as the --dirs command line parameter being used.

       DEBDIFF_CONTROL
	      If this is set to no, then it is the same as the --nocontrol command line parameter being used.  The default is yes.

       DEBDIFF_CONTROLFILES
	      Which control files to compare, corresponding to the --controlfiles command line option.	The default is control.

       DEBDIFF_SHOW_MOVED
	      If this is set to yes, then it is the same as the --show-moved command line parameter being used.

       DEBDIFF_WDIFF_OPT
	      This option will be passed to wdiff; it should be one of -p, -l or -t.

       DEBDIFF_SHOW_DIFFSTAT
	      If this is set to yes, then it is the same as the --diffstat command line parameter being used.

       DEBDIFF_WDIFF_SOURCE_CONTROL
	      If this is set to yes, then it is the same as the --wdiff-source-control command line parameter being used.

       DEBDIFF_AUTO_VER_SORT
	      If this is set to yes, then it is the same as the --auto-ver-sort command line parameter being used.

       DEBDIFF_UNPACK_TARBALLS
	      If this is set to no, then it is the same as the --no-unpack-tarballs command line parameter being used.

EXIT VALUES
       Normally the exit value will be 0 if no differences are reported and 1 if any are reported.  If there is some fatal error,  the	exit  code
       will be 255.

SEE ALSO
       dpkg-deb(1), wdiff(1), interdiff(1), diffstat(1) and devscripts.conf(5).

AUTHOR
       debdiff was originally written as a shell script by Yann Dirson <dirson@debian.org> and rewritten in Perl with many more features by Julian
       Gilbey <jdg@debian.org>.  The software may be freely redistributed under the terms and conditions of the GNU General Public  License,  ver-
       sion 2.

DEBIAN								 Debian Utilities							DEBDIFF(1)
All times are GMT -4. The time now is 01:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy