Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [file-comparison]

The tag has no usage guidance.

1
vote
2answers
51 views

Compare every nth line in 2 files and save (asymmetric) context

I have 2 files, each containing the same amount of 4-lines records, in the same order: fileA: record1 line1=header record1 line2 X <= this is different but should be ignored record1 line3 id ABC ...
1
vote
0answers
115 views

Evaluate the similarity between two video files

I'm looking for a method that reliably gives me a "mathematical distance" of two videos from one another. Similar to how the Levenshtein distance can be used to get the distance from a string to ...
-1
votes
2answers
76 views

how to compare two files and display in table format

I need to compare two files and display the difference in table format using shell script. for example. file1.txt ap-2.21.3.rpm bp-3.42.4.rpm cp-devel-3.23.2.rpm ep-devel- 2.23.2-23.rpm file2.txt ...
3
votes
1answer
146 views

How to find and delete duplicate video (.mp4) files? [closed]

I have 16,000+ short video clips and there are lots of them that are exactly alike to the human eye, but if you examine very closely you will find that one or the other may have an extra 1 second (or ...
0
votes
2answers
75 views

Compare files and select bigger one

There are two directories with many files. Those files are always matching in names and not always matching in size. For example: /dir1 |-file1 (1 MB) |-file2 (2 MB) |-file3 (3 MB) /dir2 |-file1 (1 ...
1
vote
2answers
242 views

Diff between two csv files based on the column

I have two files file1.csv and file2.csv. Below are the contents of file1.csv AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb AR.jar;9a553dd203d0979aa60004e19cc98c12 BI.jar;8022f6c5f83ba040394ff0b0a0323e8e ...
0
votes
1answer
90 views

Comparing two files with an easy readable GUI program?

I would like to compare two large files that are not close to 1Gb in size. Kompare crashes when the files load is large. I configured Kompare as in the photo below: I would like to present the ...
-1
votes
2answers
75 views

$ cmp -s file1 file2, this command doesn't return anything for the following cases: case 1: both files are different; case 2: both files are same [closed]

$ cmp -s file1 file2 The above command doesn't return anything for the following cases: Case 1: both files (file1 and file2) are different; Case 2: both files (file1 and file2) are same. I tried ...
3
votes
1answer
26 views

`cmp -b file1 file2` responses: “file1 file2 differ: 12 byte, line 2 is 154 l 151 i”, what is '154' and '151' in reference to?

$ cmp -b file1 file2 file1 file2 differ: 12 byte, line 2 is 154 l 151 i in this response what do '154' and '151' refer to?
0
votes
2answers
48 views

Way to count change in text

anyone knows the algorithm which would take 1 text, 2nd text and would give minimum instructions how to build 2nd text when I already know the 1st? e.g. output of "uptime": 16:18 up 1 day, 12:15, 4 ...
0
votes
1answer
92 views

Shell: straightforward if statement seems not working

I've written this shell script snippet: while inotifywait -e modify $ENV_LOCATION/*.env do md5sum $ENV_LOCATION/*.env > ./checksums_optwo.md5 if [ -n "$(cmp ./checksums_opone.md5 ./...
1
vote
1answer
32 views

Compare text files skipping N symbols from each line

Can I compare two text files skipping N symbols from start of the each line? For example file1: 2018-05-31 12:00:00 This is the first line of text. 2018-05-31 12:00:00 This is the second line of ...
1
vote
1answer
86 views

Error when compare big numbers

Trying to use this #!/bin/bash SIZE=$(redis-cli info | grep used_memory: | awk -F':' '{print $2}') MAX=19000000000 if [ "$SIZE" -gt "$MAX" ]; then echo 123 fi But always getting: "Ganzzahliger ...
0
votes
2answers
29 views

Converting number format and comparing the file

I have a file with 174 fields. The first 4 fields are given below 1|2.3|2.3|34 1|0|0|34 1|0.0|0.0|34 1|11|11|34 1|.3|.3|34 1|-0.00|-0.00|34 1|1.67|1.67|34 I need to convert it into this: 1|2.30|2....
1
vote
2answers
64 views

Compare two file sizes and delete smaller file

I'm looking for a way to delete the smaller of two files. I have found a way to find the duplicate files in my Movie Library, but now I need to delete the smaller file. bash - Find All Files with ...
3
votes
3answers
121 views

Comparing two files linewise and if pattern of file 1 is not found (fully or partially) in file 2 then print line of file 1

I have two files: file1 (search): 1 GACGGAGGATGCAAGTGTTATCCGGAATCACTGGGCGTAAAGTTTTTTTTT 2 GACGGAGGATGCAAGTGTTATCCGGAAT 3 GACGGAGGATGCAAGTGTTATCCGGAATCACTGGGCGTAAAGCGTCC 4 ...
0
votes
1answer
2k views

compare 2 csv files and output only difference into variable

1.csv: rundeck-read-only-iam-permissions,IAMReadOnlyAccess citrix-xendesktop-ec2-provisioning",AmazonEC2FullAccess 2.csv: citrix-xendesktop-ec2-provisioning",AmazonEC2FullAAA citrix-xendesktop-ec2-...
2
votes
6answers
2k views

Compare files from a list

I have got a file list (<10) as output of some command. For example: $ find foo* -name bar*Test.groovy foofoo/foo-tasks/src/test/groovy/foo_main/store/barEarthTest.groovy foo-co/foo-tasks/src/...
1
vote
1answer
476 views

rsync: Compare 2 directories, copy and rename different files instead of overwriting target

I can't find a solution to do the following with rsync on Linux: Compare two folders When found two identical files on the same root position on both source tree and target tree, with same name, but ...
1
vote
0answers
26 views

Logging remote file to rsyslog

I have an embedded system that does not support remote logging, but I can download its log file over HTTP, e.g. with: wget http://192.168.1.1/status/syslog.log I'd like to use a third machine to get ...
0
votes
2answers
73 views

How to compare dates (line by line) and get a date range?

I have 2 files with dates, which look like so: # cat file_1 20190105 20171124 # cat file_2 20190112 20171201 How do I compare dates (line by line) and get a date range? For example, something like ...
2
votes
1answer
225 views

Compare two logs line by line and show differences and if the order of words from a line are not the same [duplicate]

I Don't need a tool I need an implemetation/alghorithm :) I need to make a shellscript because I can't install anything on the server f2.txt She has 123 apples George 18 years is old Florin it's ...
-1
votes
6answers
3k views

How can I compare two files line by line?

I have two files A and B which are almost same with some lines different and with some lines jumbled. Since the two files are systemverilog files the lines also contain special characters like ; , = + ...
6
votes
1answer
667 views

What do these codes in 'diff' mean and how to get rid of them?

I am using diff to find difference from current file to a target. The command I have is diff -w --from-file /tmp/new_list.txt /tmp/protected_client.txt The output is 8c8,9 > VM-E I filtered ...
3
votes
1answer
41 views

Files Affected By Command

Is there a way to know which files are affected by any command that's entered in terminal? For instance, we all know what passwd command does, and which file it affects. But is there a definite way to ...
0
votes
1answer
513 views

Compare similarity or levenshtein distance between each line pair within a file?

I'd like to find the most similar line pair contained within a file, using something like levenshtein distance. For instance, given a file along the lines of: What is your favorite color? What is ...
0
votes
2answers
345 views

comm is not proving expected result

I have couple of files (file 1.txt and file2.txt) and I am using unix "comm" command to compare those files to find out unique lines on file1.txt Here are the lines having on file1.txt: OD1 EN2 OD3 ...
-1
votes
2answers
100 views

Compare two files and output match

I have files similar to this: File1: 1.1.1.7 mounting of udf filesystems is disabled Fail 1.1.1.8 mounting of FAT filesystems is disabled Fail 1.1.5 noexec option set on /tmp partition Fail 1.1....
1
vote
1answer
76 views

Weird compression question

I'm trying to compress some raw sensor data from older recordings that I need and don't want to remove from my Centos server. The data recorded is in a proprietary format, but for all intents and ...
2
votes
1answer
428 views

Can diff show numerical differences, with a threshold to not show them as differences?

My diff shows some numerical differences between two log files. That means for example: fileA: Parameter n (fill abs) /All_Data/Height 9830400 fileB: ...
2
votes
1answer
506 views

Comparing two files and writing mismatched rows along with mismatched columns. Pointing out the mismatched columns is my main problem statement

I got a requirement where I need to compare two files wrt to each columns and write the corresponding difference in another file along with some identification showing mismatched columns. Pointing out ...
3
votes
0answers
108 views

Set custom application for file comparison in caja

How can I set custom application which is being invoked when I press "Differences" button in "File Conflict" dialog? I did not find corresponding option in "File Management Preferences". I did not ...
1
vote
2answers
2k views

Comparing csv files to lookup column 1 then check values in column 2

OK, I will try and explain what I need to do as best as possible. Basically I have two CSV files, as per the examples below: File 1: Column 1, Column 2 abc , 123 def , 234 adf , 567 ...
3
votes
1answer
111 views

Naive line-by-line comparison like “comm -3” but looking like “diff -y”

I am looking from something which gives me an output of comm -3 on two sorted outputs (line-by-line comparison, only additional/missing lines from either side) but which looks more like the output ...
-1
votes
2answers
299 views

Compare a sorted and an unsorted file

I have two files that I want to compare. A sorted and an unsorted one. ex fileA (sorted) ABA FRE DIR ex fileB (unsorted) AJGHEKSLANVJJFABAKEIFJA OPTOEKSMKVMGKVABAALKKSK is there a way ...
0
votes
1answer
42 views

Comparing multiple files and printing larger values along with filenames

I have about 2000 files in the following format: FILEA: WHWH-19975612.txt 0.1 70 30 0.01 70 32 0.9 72 32 ... FILEB: WHWH-20004526.txt 0.2 70 30 0.001 70 32 1.0 72 32 ... Desired ...
1
vote
3answers
872 views

quickly compare values in a text file

I have a text file with 2 columns first column is a name, second colomn is an time value. like: cat 34M dog 34M fish 12M ant 34M I need to compare the second colomn for the same values, and if 1 ...
0
votes
1answer
52 views

Compare column names in two files

I have the first file with 1099 columns #rnaseq/SNPID hg19Location Gene TCGA-BH-A0C0-01A TCGA-A2-A3XY-01A TCGA-XX-A89A-01A TCGA-B6-A0I2-01A TCGA-LL-A6FP-01A TCGA-EW- ...
1
vote
4answers
788 views

Shell comparing two list, and output the difference on a third list

I have two text files, a.txt and b.txt where: a.txt 1 2 3 4 5 b.txt 3 5 I'd like to have c.txt where matching numbers will be printed "0" and non matching numbers to be "1". 1 1 0 1 0 I ...
1
vote
0answers
757 views

Use rsync to compare a remote directory with a local one, and store differences to another local directory

My problem is similar to the one described in this question. I want to compare a directory to another, and store the differences in a third one. The difference is that in my case the first directory ...
2
votes
1answer
919 views

Compare different IPs in two files? [closed]

I have a list from an inventory and another list from management. I'm trying to find the IP's that are similar between both files then output that is similar into another file: I tried using diff but,...
0
votes
1answer
412 views

Compare two files and display the output with matches,duplicates and nomatches [duplicate]

I have 2 files, file1 -> abc=3 abc=3 dfg=6 ggg=7 file2 -> abc=3 dfg=4 sdf=9 I want the output in file3 as, File2,File1,Result abc=3,abc=3,Match dfg=4,dfg=6,NoMatch sdf=9,,NotPresent ,abc=3,...
1
vote
0answers
58 views

Compare file dates from two directories

I have two directories with files with the same name. Basically I want to replace dir1/file.txt with dir2/file.txt if the creation date of dir1/file.txt is more recent. But i think I'm missing ...
1
vote
1answer
57 views

Compare two directiory excluding the files extensions

I have two directories: dir1 and dir2 In dir1 I have files like: blacklist1.dat.bz2 blacklist2.dat.bz2 blacklist3.dat.bz2 and so on. In dir2 I have encrypted files like: blacklist1.dat.bz2.enc I ...
3
votes
1answer
1k views

How to copy/merge two directories and if two files have the same name rename the older one appending its modification time

I have several directories with files which mostly have the same name but might be different and I need to have all these directories merged into a new one. I need to be able to compare the same named ...
3
votes
1answer
53 views

Comparing single column of a file with another

I have two files: aaaa 11 0.4 12 0.2 aaab 40 0.1 99 0.2 69 0.3 aaac 222 0.5 21 0.3 aaad 2 0.1 aaae 33 0.3 .... and aaaa aaac aaae .... I need to compare the first column of first file with second ...
0
votes
2answers
94 views

Compare two files and print matches in the first file adding extra column

I have two different files with one column each. The file 1 has more info and I want a command to search the matches against the file 2 and then return the original file 1 with an extra column saying ...
1
vote
1answer
196 views

Compare two files line by line without comm (I need to maintain order of file 1)

File 1: happy sad calm palm File 2: palm dream calm I want to compare the two files and display only those line that are common in both the files, but I want to maintain the order of File 2. My ...
2
votes
1answer
126 views

How to find files with same name but different line count in two directories?

I have a directory sub1 with the following files: $ wc -l * 5 file1.csv 5 file3.csv 1 file4.csv In sub2, I have the following: $ wc -l * 5 file1.csv 5 file2.csv 1 file3.csv 5 file4.csv 1 file5.csv ...
1
vote
1answer
687 views

How can I copy a .wav file from an audio cd and verify it?

I have a hard time using Linux' built-in tools to rip an audio cd (sound juicer, rhythmbox). The reason likely being my drive, which vibrates a lot and cannot read the disk continuously. Playing the ...