View difference between Paste ID: XGVnKt4b and LrSnbqKA
SHOW: | | - or go back to the newest paste.
1
# This functions prints the menu and takes the menu option input
2
menu() {
3
	clear
4
	
5
	printf "Here are the operation you can do to your file
6
	1. Word Count
7
	2. First 10 lines of file
8
	3. Last 10 lines of file
9
	4. Content of line before and after sorting\n"
10
	read option
11-
	printf "Choose your option\n"
11+
12
	# Ask for the path of file to perform the operations
13
	printf "Enter the path to the file:\n"
14
	read path
15
 
16
	# Call appropriate function according to the operation you want to perform 
17
	case $option in
18
		# This option count the number of words,characters and line in the file
19
		1 ) wc $path  ;;
20
		# This option displays the first 10 lines of file
21
		2 ) head $path  ;;
22
		# This option displays the last 10 lines of file
23
		3 ) tail $path  ;;
24
		# This function display the file before sorting and after sorting
25
		4 ) 
26
			printf "before sorting\n"
27
			cat $path
28
			sort $path
29
			printf "After sorting"
30
			cat $path 
31
		;;
32
	esac
33
 
34
	read
35
	menu
36
}
37
38
menu