Bucket sorting is a sorting algorithm that works with partitioning an array into a number of packets. Each bucket sorted individually using the same or different algorithm. Bucket sort and radix sort look like same. But it has some difference.

Radix sort is a linear sorting algorithm that sorts data by grouping keys. The individual digits which share the same significant position and value.

Radix sort helps to sort fixed length words. Radix sort requires fixed size key and difficult to generalize. It can use with integers, fixed size strings, and “less than”, “greater than” or “lexicographic order” comparison predicates.

Heap sort is a comparison-based sorting algorithm and divides the input into a sorted and an unsorted region, and it iteratively shrinks the unsorted region by extracting the largest element and moving that to the sorted region.

Merge sort is a divide and conquer and comparison-based sorting algorithm. It divide the array into subarray and conquer by recursively sorting two subarrays. It combines the results into the final array.

Bubble sort is a simple sorting algorithm. It compares each item from the array and swap with an adjacent item if they are not in order. The main advantage of bubble sort is an easy implementation. Bubble sort has poor performance and should be avoided in case of a large number of elements in the array.

grep command is used to search text or searches the given file for lines containing a match to the given strings or words.The grep search the string from given file and returns the number of occurrences and index for each string in the file. Write program to take file, search string and find the number of occurrences and list of index values from the given string.