※追記:cat a.txt b.txt | sort | uniq -d で解決します
worseway
1 #!/bin/bash
2
3 if [ $# = 0 ] ; then
4 echo "set 2args"
5 exit 1
6 fi
7
8 if [ ! -f $1 ] ; then
9 echo "no such file: $1"
10 exit 1
11 fi
12
13 if [ ! -f $2 ] ; then
14 echo "no such file $2"
15 exit 1
16 fi
17
18 cat $1 | while read line1
19 do
20 cat $2 | while read line2
21 do
22 if [ $line1 = $line2 ] ; then
23 echo $line1
24 fi
25 done
26 done
※データ多いと死にます。ハッシュマップ使いたいすね。