clear
ch=1
while true
do
echo "MENU"
echo "-----"
echo "1.Comparing two files"
echo "2.Difference between two files"
echo "3.Common between two files"
echo "4.Exit"
echo "Enter our choice"
read ch
case $ch in
1)
echo "Compare two files"
echo "---------------"
echo "Enter the first file name"
read r1
echo "Content of the file"$r1
cat $r1
echo "Enter the second file name"
read r2
echo "Content of the file"$r2
cat $r2
echo "Compare two files"
echo "---------------"
cmp $r1 $r2
;;
2)
echo "Difference between two files"
echo "------------------------"
echo "Enter the first file name"
read d1
echo "Content of the file"$d1
cat $d1
echo "Enter the second file name"
read d2
echo "Content of the file"$d2
cat $d2
echo "Differ two files"
echo "------------"
diff $d1 $d2
;;
3)
echo "Common between two files"
echo "-----------------------"
echo "Enter the first file name"
read c1
echo "Content of the file"$c1
cat $c1
echo "Enter the second file name"
read c2
echo "Content of the file"$c2
cat $c2
echo "Common two files"
echo "---------------"
comm $c1 $c2
;;
4)
echo "Exit"
echo "---"
exit
;;
esac
done
-------------
OUTPUT:
-------------
Menu
-------
1.Compare two files
2.Difference between two files
3.Common between two files
4.Exit
Enter our choice
1
Compare two files
----------------------
Enter the first file name
cmp
Content of the file :cmp
madurai
thrichy
mysore
delhi
Enter the second file name
cmp1
Content of the file :cmp1
madurai
thrichy
chennai
delhi
banglore
Compare two files
----------------------
cmp cmp1 differ:byte 5,line 1
Enter our choice
2
Difference between two files
-----------------------------------
Enter the first file name
cmp
Content of the file:cmp
madurai
thrichy
mysore
delhi
Enter your second file name
cmp1
Content of the file :cmp1
madurai
thrichy
chennai
delhi
banglore
Differ two files
------------------
1c1
<madurai
---
>madurai
3c3
<mysore
---
>chennai
4a5
>banglore
Enter our choice
3
Common between two files
---------------------------------
Enter the first file name
cmp
Content of the file :cmp
madurai
thrichy
mysore
delhi
Enter the second file name
cmp1
Content of the file:cmp1
madurai
thrichy
chennai
delhi
banglore
Common Two Files
------------------------
madurai
madurai
Thrichy
Chennai
delhi
banglore
mysore
delhi
Enter your choice
4
Exit
ch=1
while true
do
echo "MENU"
echo "-----"
echo "1.Comparing two files"
echo "2.Difference between two files"
echo "3.Common between two files"
echo "4.Exit"
echo "Enter our choice"
read ch
case $ch in
1)
echo "Compare two files"
echo "---------------"
echo "Enter the first file name"
read r1
echo "Content of the file"$r1
cat $r1
echo "Enter the second file name"
read r2
echo "Content of the file"$r2
cat $r2
echo "Compare two files"
echo "---------------"
cmp $r1 $r2
;;
2)
echo "Difference between two files"
echo "------------------------"
echo "Enter the first file name"
read d1
echo "Content of the file"$d1
cat $d1
echo "Enter the second file name"
read d2
echo "Content of the file"$d2
cat $d2
echo "Differ two files"
echo "------------"
diff $d1 $d2
;;
3)
echo "Common between two files"
echo "-----------------------"
echo "Enter the first file name"
read c1
echo "Content of the file"$c1
cat $c1
echo "Enter the second file name"
read c2
echo "Content of the file"$c2
cat $c2
echo "Common two files"
echo "---------------"
comm $c1 $c2
;;
4)
echo "Exit"
echo "---"
exit
;;
esac
done
-------------
OUTPUT:
-------------
Menu
-------
1.Compare two files
2.Difference between two files
3.Common between two files
4.Exit
Enter our choice
1
Compare two files
----------------------
Enter the first file name
cmp
Content of the file :cmp
madurai
thrichy
mysore
delhi
Enter the second file name
cmp1
Content of the file :cmp1
madurai
thrichy
chennai
delhi
banglore
Compare two files
----------------------
cmp cmp1 differ:byte 5,line 1
Enter our choice
2
Difference between two files
-----------------------------------
Enter the first file name
cmp
Content of the file:cmp
madurai
thrichy
mysore
delhi
Enter your second file name
cmp1
Content of the file :cmp1
madurai
thrichy
chennai
delhi
banglore
Differ two files
------------------
1c1
<madurai
---
>madurai
3c3
<mysore
---
>chennai
4a5
>banglore
Enter our choice
3
Common between two files
---------------------------------
Enter the first file name
cmp
Content of the file :cmp
madurai
thrichy
mysore
delhi
Enter the second file name
cmp1
Content of the file:cmp1
madurai
thrichy
chennai
delhi
banglore
Common Two Files
------------------------
madurai
madurai
Thrichy
Chennai
delhi
banglore
mysore
delhi
Enter your choice
4
Exit
0 comments:
Post a Comment