如何使用Schell脚本在两个文件之间查找常用词

我有两个文件Corbeau.txt和Loup.txt。我想通过shell脚本找到它们的共同用语。

我做到了。 有什么想法吗?

#!/bin/sh

corbeau_txt=$(egrep -o "\w{2,}" Corbeau.txt | sort | uniq)

loup_txt=$(egrep -o "\w{2,}" Loup.txt | sort | uniq)

communs=" "

for mot1 in $corbeau_txt
do
        for mot2 in $loup_txt
        do
                if [ $mot = $mot2 ]
                then
                        communs=$mot2
                        echo $communs
                fi
        done
done
dianxinwad 回答:如何使用Schell脚本在两个文件之间查找常用词

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3127867.html

大家都在问