When debugging, novices insert corrective code; experts remove defective code. Richard Pattis

File indexing

Language Java | Level Intermediate | Category Algorithms | August 2, 2015 8:18 pm


Algorithm Problem Description

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.

Output

          	        
          	        

Search file Name: 'src/com/dsacode/Algorithm/search/FileGrep.java'
Search keyword: 'static'
Mapped from 0 for 3709
Times found at: 4
Word found at: 13, 15, 66, 76

          	        
          	        				    


Comments



Please login to add comments.