Skip to main content

All Questions

Tagged with
-1 votes
2 answers
90 views

In bash/zsh, how to compare the metadata in two directories including . and excluding .. and the contents inside subdirectories?

Let's say that in a script, you have a directory $1 and its copy $2 and you'd like to compare the metadata (names, permissions, sizes, full modification dates, …) of the files and directories inside ...
AlMa1r's user avatar
  • 260
2 votes
3 answers
393 views

How to compare two directories recursively, and for each pair of files with the same name, location, and contents, say which file is older?

In a Linux shell, how to compare two directories recursively, and for each pair of files (including symlinks and directories) with the same location (including the name) in the two directories and the ...
AlMa1r's user avatar
  • 260
0 votes
0 answers
59 views

Help with creating a bash code to compare two different files

I'm currently encountering some challenges while working on a bash script in the Linux terminal to perform the following tasks: Compare the values in the third column of two different files line by ...
duduzba's user avatar
2 votes
2 answers
1k views

How to apply a patch as part of a pipe? In other words, how to patch stdin?

I want to apply a unified diff from mypatch.diff to stdin and output the result to stdout. So far, I have tried: patch -i mypatch.diff -o - -u originalfile Which successfully applies mypatch.diff and ...
finefoot's user avatar
  • 3,504
10 votes
1 answer
1k views

Space not taken as an argument separator by shell script (could someone please explain that small file difference ?)

SHORT VERSION (TL;DR) I have 2 small one-line files, seemingly identical : $ cat f1 f2 ./cconv.sh 100 EUR USD ./cconv.sh 100 EUR USD But they are not, there is a 1 byte difference in size : $ ls -l ...
ChennyStar's user avatar
  • 1,855
0 votes
1 answer
1k views

looking to compare two directories using boolean statement

just looking to compare two directories and make sure that all files reside in both, I'm aware of the diff cmd but is there a way to use Boolean logic? if directory a contents == directory b contents ...
AlekNaomie BurtPilon's user avatar
1 vote
3 answers
262 views

diff: Find files that differ and are in the second directory

Say that I have these files for example: old/common-change/index.html new/common-change/index.html new/only-new/index.html old/only-old/index.html The output of diff -qr is close to what I want: $ ...
bbaovanc's user avatar
0 votes
1 answer
91 views

Relaxing cmp conditions on diff

Is there a independent diff tool that ignores differences as long as they're only related to row ordering and not content? For example, a.txt: aa bb and b.txt: bb aa should be identical, since they ...
Sebi's user avatar
  • 1,029
1 vote
1 answer
42 views

How to compare corresponding multiple files with each other in the same directory

Hi so I have a folder like /mell/908 which contains files as follows: cf-mell-pos-908-tcg-4619e.txt cf-mell-pos-908-tcw-4619e.txt cf-mell-pos-908-usc-4619e.txt cf-mell-pos-908-wi_board-4619e.txt ...
raxchi's user avatar
  • 13
6 votes
4 answers
5k views

How to merge two folders so as to remove identical files from one, while keeping checksummed differentials?

I have a scenario where I have a recovery from a drive from possibly a different point in time that is not only potentially different in terms of files being present, but also there was some ...
ylluminate's user avatar
1 vote
1 answer
2k views

diff marking each line as old, new, or unchanged

I need to diff two unsorted text files with the output marking every line as either old, new, or unchanged. The marks should appear at the beginning or end of the line, and there should be no other ...
Psychonaut's user avatar
0 votes
1 answer
2k views

How do I check the result of a command for an output vs no output in zsh if statement?

I would like to compare 2 files using diff and then if it returns nothing then echo "no diff" else display the difference. My current if statement only works if there is no difference but if there is ...
ntruter42's user avatar
  • 197
6 votes
3 answers
2k views

Find files that have the same name as the directory

I have the next problem: Directory Example1 has three files: Example1, Things and Pictures. Directory Example2 has three files: Example2, Example3 and Pictures. I need a list showing only the ...
ChangKo's user avatar
  • 63
-4 votes
1 answer
57 views

i want a linux script that will be able to compare both files and after comparing it should display something

file 1 products total apple 6 yam 5 fish 6 meat 3 file2 products total apple 6 yam 7 ...
bob's user avatar
  • 1
0 votes
1 answer
643 views

Can I use `diff` to display not the different but the matching parts?

man diff says: diff - compare files line by line So diff will compare the files. However, eventually, it will show the difference, if there is any. How can I compare the files and show the matching ...
finefoot's user avatar
  • 3,504

15 30 50 per page