Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This functions prints the menu and takes the menu option input
- menu() {
- clear
- printf "Here are the operation you can do to your file
- 1. Word Count
- 2. First 10 lines of file
- 3. Last 10 lines of file
- 4. Content of line before and after sorting"
- # Ask for the path of file to perform the operations
- printf "Enter the path to the file:\n"
- read path
- printf "Choose your option\n"
- read option
- # Call appropriate function according to the operation you want to perform
- case $option in
- # This option count the number of words,characters and line in the file
- 1 ) wc $path ;;
- # This option displays the first 10 lines of file
- 2 ) head $path ;;
- # This option displays the last 10 lines of file
- 3 ) tail $path ;;
- # This function display the file before sorting and after sorting
- 4 )
- printf "before sorting\n"
- cat $path
- sort $path
- printf "After sorting"
- cat $path
- ;;
- esac
- menu
- }
- menu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement