Você pode usar o seguinte script como exemplo:
#!/bin/sh
outfile="outfile"
echo "testfile1:"
cat testfile1
echo "testfile2:"
cat testfile2
cat /dev/null > $outfile
cat testfile1 | while read line; do
matchfirst="'echo $line | awk '{print $3}''"
matchsecond="'echo $line | awk '{print $4}''"
finded="false"
while read defline; do
tplfirst="'echo $defline | awk '{print $3}''"
tplsecond="'echo $defline | awk '{print $4}''"
if [ "$tplfirst" = "$matchfirst" ] && [ "$tplsecond" = "$matchsecond" ]; then
echo -n "'echo $defline | awk '{print $1}'' 'echo $defline | awk '{print $2}'' 'echo $line | awk '{print $3}'' 'echo $line | awk '{print $4}''" >> $outfile
echo >> $outfile
finded="true"
fi
done < testfile2
if [ "$finded" = "false" ]; then
echo $line >> $outfile
fi
done
echo "outfile:"
cat outfile
Exemplo de uso:
➜ sild@$work 15:29:55 [test]$ ./replacer.sh
testfile1:
1 2 3 4
5 6 7 8
9 10 11 12
testfile2:
11 21 3 4
51 61 7 8
9 10 111 121
outfile:
11 21 3 4
51 61 7 8
9 10 11 12
É o seu objetivo?