Reconciliation in Bash Script

2 تیر 1402 - خواندن 2 دقیقه - 233 بازدید


Reconciliation in Bash Script

We can use different commands for Reconciliation in Linux. One of these commands is diff, The diff command can compare millions of records in files. diff stands for difference. We need diff when we need to use it to display line-by-line differences in files. The important thing to remember is that diff uses certain special symbols and instructions that are required to make two files identical. It tells you the instructions on how to change the first file to make it match the second file.

$ ls

a.txt b.txt

$ cat a.txt

Gujarat

Uttar Pradesh

Kolkata

Bihar

Jammu and Kashmir

$ cat b.txt

Tamil Nadu

Gujarat

Andhra Pradesh

Bihar

Uttar pradesh

$ diff a.txt b.txt

0a1

> Tamil Nadu

2,3c3

< Uttar Pradesh

Andhra Pradesh

5c5

Uttar pradesh

To Compare the Contents of Two Files

diff [ -c| -C Lines | -D [ String ] | -e | -f | -n | -u | -U Lines ] [ -b ] [ -i ] [ -t ] [ -w ] File1 File2

diff [ -h ] [ -b ] File1 File2

To Sort the Contents of Directories and Compare Files That Are Different

diff [ -c | -C Lines | -e | -f | -n | -u | -U Lines ] [ -b ] [ -i ] [ -l ] [ -r ] [ -s ] [ -S File ] [ -t ] [ -w ] Directory1 Directory2

diff [ -h ] [ -b ] Directory1 Directory2

Mostafa jahanpur