Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This functions prints the menu, ask for the path of file and perform appropriate operations on that file
- menu() {
- clear
- printf "Here are the operations 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\n"
- read option
- # Ask for the path of file to perform the operations
- printf "\nEnter the path to the file:\n"
- read path
- # Perform appropriate operations according to the options
- case $option in
- # Execute the wc command foe the file
- 1 ) wc $path ;;
- # Display first 10 lines of a file
- 2 ) head $path ;;
- # Show first the last 10 lines of a file
- 3 ) tail $path ;;
- # Display the file before and afer sorting
- 4 )
- printf "before sorting\n"
- cat $path
- sort $path
- printf "After sorting"
- cat $path
- ;;
- esac
- read
- menu
- }
- menu
Advertisement
Add Comment
Please, Sign In to add comment