小编san*_*ddy的帖子

bash脚本中的两个文件比较?

如何在shell脚本中找到匹配数据的两个文件并在shell中的另一个文件中重复存储数据?

#!/bin/bash

file1="/home/vekomy/santhosh/bigfiles.txt"
file2="/home/vekomy/santhosh/bigfile2.txt"

while read -r $file1; do
    while read  -r $file2 ;do
        if [$file1==$file2] ;  then
            echo "two files are same"
        else
            echo "two files content different"
        fi
    done
done
Run Code Online (Sandbox Code Playgroud)

我写了代码,但没有用。怎么写?

bash file-comparison

11
推荐指数
2
解决办法
8万
查看次数

标签 统计

bash ×1

file-comparison ×1