Here is one solution using awk, considering that numbers are separated by single spaces in between, otherwise change the delimiter at the split function :
#!/bin/bash
echo "Input numbers"
read input1
echo "Input numbers"
read input2
if [ "$input1" == "$input2" ]
then
echo "Match"
else
echo " The numbers that don't match are: "
awk -v a="$input1" -v b="$input2" 'BEGIN {x=split(a,arra," ");y=split(b,arrb," ")
if ( x > y)
{ for ( i=1; i<=x; i++)
if ( arra != arrb )
print arra " <---> " arrb
exit }
else if ( x < y )
{ for ( i=1; i<=y; i++)
if ( arra != arrb )
print arra " <---> " arrb
exit }
else ( x = y )
{ for (i=1; i<=x; i++)
if ( arra != arrb)
print arra " <---> " arrb
exit }
}'
fi
if \( x > y\)
\{ for \( i=1; i<=x; i\+\+\)
if \( arra [i]!= arrb [i]\)
\{
if \( arra [i]== arrb[i\+1] \)
\{
print arrb
[i]break
\}
else if \( arra[i\+1] == arrb [i]\)
\{
print arra
[i]break
\}
else
print arra [i]" <---> " arrb
[i]\}
exit \}
else if \( x < y \)
\{ for \( i=1; i<=y; i\+\+\)
if \( arra [i]!= arrb [i]\)
\{
if \( arra [i]== arrb[i\+1] \)
\{
print arrb
[i]break
\}
else if \( arra[i\+1] == arrb [i]\)
\{
print arra
[i]break
\}
else
print arra [i]" <---> " arrb
[i]\}
exit \}
else \( x = y \)
\{ for \(i=1; i<=x; i\+\+\)
if \( arra [i]!= arrb[i]\)
\{
if \( arra [i]== arrb[i\+1] \)
\{
print arrb
[i]break
\}
else if \( arra[i\+1] == arrb [i]\)
\{
print arra
[i]break
\}
else
print arra [i]" <---> " arrb
[i]\}
exit \}
#!/usr/bin/env sh
# @(#) s1 Demonstrate "word" differences.
# ____
# /
# | Infrastructure BEGIN
echo
set -o nounset
debug=":"
debug="echo"
## The shebang using "env" line is designed for portability. For
# higher security, use:
#
# #!/bin/sh -
## Use local command version for the commands in this demonstration.
set +o nounset
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version =o $(_eat $0 $1) wdiff
set -o nounset
echo
a=${1-data1}
echo " Input file $a:"
cat $a
b=${2-data2}
echo " Input file $b:"
cat $b
# | Infrastructure END
# \
# ---
echo
echo " Results from processing:"
wdiff -3 $a $b
exit 0
Producing:
% ./s1 data3 data4
(Versions displayed with local utility "version")
Linux 2.6.11-x1
GNU bash, version 2.05b.0(1)-release (i386-pc-linux-gnu)
GNU wdiff 0.5
Input file data3:
1 2 3 4 5 80 90
Input file data4:
1 2 3 4 5 6 80 90
Results from processing:
======================================================================
{+6+}
======================================================================
awk '
NR==FNR{sub(/\n/,"");a1[$0]=$0;next}
{sub(/\n/,"");a2[$0]=$0;if ( ! ( $0 in a1 ) ){print "In file 2 but not in 1:"$0}}
END {for ( i in a1 )
if ( ! ( i in a2 ) ) {print "In file 1 but not in 2:"i}
}' RS=' ' f1 f2
$ awk '
NR==FNR{sub(/\n/,"");a1[$0]=$0;next}
{sub(/\n/,"");a2[$0]=$0;if ( ! ( $0 in a1 ) ){print "In line 2 but not in 1:"$0}}
END {for ( i in a1 )
if ( ! ( i in a2 ) ) {print "In line 1 but not in 2:"i}
}' RS=' ' file1 file2
In line 2 but not in 1:4
In line 2 but not in 1:5
In line 1 but not in 2:15