bash
#!/bin/sh
str=""
for i in $@
do
str="${str}$(sed 's|\.||g' $i) " # remove the period and add space between files.
done
echo $str | tr -s ' ' '\n' | sort | uniq -c | sort -nr
bash
$ thescript file1.txt file2.txt
Output:
bash
3 a
2 mary
2 little
2 lamb
2 had
1 you
1 white
1 went
1 was
1 that
1 snow
1 Mary
1 How
1 His
1 Hello
1 fleece
1 everywhere
1 as
1 are
1 And